Aaaaa988

fromQNX Source

Dec 24th, 2020
69
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <stdio.h>
  2. #include <pthread.h>
  3. #include <unistd.h>
  4. #include <stdlib.h>
  5. #include <sys/types.h>
  6. #include <sys/stat.h>
  7. #include <fcntl.h>
  8. #include <sys/neutrino.h>
  9. #include <sys/syspage.h>
  10. #include <iostream>
  11.  
  12.  
  13. using namespace std;
  14.  
  15. int coid;
  16.  
  17. void* func(void *){
  18. long long start, stop, res;
  19. char rmsg;
  20.  
  21. printf("Source: sending empty msg\n");
  22. start = ClockCycles();
  23. MsgSend(coid, NULL, 0, NULL, 0);
  24. stop = ClockCycles();
  25. res = stop - start;
  26.  
  27. printf("Source: Cycles = %lld\n",res);
  28.  
  29. }
  30.  
  31. int main(){
  32. int child;
  33. int pid;
  34. int thread;
  35.  
  36. int fd = open("taskOne.txt", O_RDWR);
  37. read(fd, &pid, 4);
  38. read(fd, &child, 4);
  39.  
  40. printf("Source: connected to pid = %d\n",pid,child);
  41. coid = ConnectAttach(0, pid, child, 0, 0);
  42.  
  43. pthread_create(&thread, 0, func, NULL);
  44.  
  45. usleep(100000);
  46. return 0;
  47. }
RAW Paste Data