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 child;
- void* func(void*){
- char rmsg, msg = 's';
- int rcvid = MsgReceive(child, NULL, 0, 0);
- printf("Receiver: received empty msg\n");
- MsgReply(rcvid, 0, NULL, 0);
- }
- int main() {
- int pid;
- int thread;
- child = ChannelCreate(0);
- pid = getpid();
- int fd = open("taskOne.txt", O_CREAT|O_RDWR, 0666);
- write(fd, &pid, 4);
- write(fd, &child, 4);
- printf("Receiver: have pid = %d\n", pid, child);
- pthread_create(&thread, 0, func, NULL);
- usleep(1000);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement