embedded linux - Using interprocess semaphores in a forked process -
embedded linux - Using interprocess semaphores in a forked process -
i testing custom inter-process semaphore implementation semaphore called function, ie, 1 function create semaphore, function take semaphore , on.
i forking process , found out utilize same semaphore across parent , kid process, u should create semaphore in shared memory ie:
(sem_t *sem = mmap address)
but cannot pass sem_t *sem
value custom function (it has 1 argument, semaphore name).
what can create function run in shared memory space? help welcome. thx.
example (from comments):
semcreate_custom(char* sem_name) { sem_t sem; struct.semaph_name = sem_name; sem_id = sem_create(sem,1,1); struct.semaph_id = sem_id; //more similar code }
semaphore embedded-linux
Comments
Post a Comment