addr=mmap(0,5003,PROT_READ|PROT_WRITE,MAP_SHARED,id,0);
*addr=&bin_sem1;
addr=mmap(0,5003,PROT_READ|PROT_WRITE,MAP_SHARED,id,0);
*addr=&bin_sem1;
To copy to clipboard, switch view to plain text mode
Are you sure this is what you want? I doubt that... You're assigning a pointer containing a local address of the semaphore to the content of the address returned by mmap.... What is that supose to do?
I was thinking about using shmget and shmat... After attaching a shared memory segment , you'll probably have to create a semaphore and memcpy it to the shared segment, initialise it there and only then use it from the other process.
Bookmarks