Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <pthread.h>
- #include <unistd.h>
- #include <stdlib.h>
- #include <sys/types.h>
- #include <sys/stat.h>
- #include <fcntl.h>
- #include <sys/neutrino.h>
- #include <sys/syspage.h>
- #include <iostream>
- using namespace std;
- int coid;
- void* func(void *){
- long long start, stop, res;
- char rmsg;
- printf("Source: sending empty msg\n");
- start = ClockCycles();
- MsgSend(coid, NULL, 0, NULL, 0);
- stop = ClockCycles();
- res = stop - start;
- printf("Source: Cycles = %lld\n",res);
- }
- int main(){
- int child;
- int pid;
- int thread;
- int fd = open("taskOne.txt", O_RDWR);
- read(fd, &pid, 4);
- read(fd, &child, 4);
- printf("Source: connected to pid = %d\n",pid,child);
- coid = ConnectAttach(0, pid, child, 0, 0);
- pthread_create(&thread, 0, func, NULL);
- usleep(100000);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement