Advertisement
Aaaaa988

main

Dec 24th, 2020
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  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. using namespace std;
  13.  
  14. int child;
  15.  
  16. void* func(void*){
  17. char rmsg, msg = '';
  18. int rcvid = MsgReceive(child, NULL,0,0);
  19.  
  20. printf("[serv]: received msg\n");
  21. MsgReply(rcvid, 0, NULL, 0);
  22. }
  23.  
  24. int main(){
  25. int pid;
  26. int thread;
  27. child = ChannelCreate(0);
  28. pid = getpid();
  29. int fd = open ('taskOne.txt', O_CREAT + O_RDWR, 0666); //что за сатана
  30. write(fd, &pid, 4);
  31. write(fd, &child, 4);
  32. printf("Server: pid = %d; child = %d\n", pid, child);
  33. usleep(1000);
  34. return 0 ;
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement