1837257 Members
2357 Online
110115 Solutions
New Discussion

semaphore

 
tarek_3
Frequent Advisor

semaphore

sorry i send this message twice with in the wrong category,i hope this time ....
hi
i have a probleme with my c program.
when i kill my program the semaphore related still set. the program run as root
how can i know the correct ID to remove semaphore set related to my program.
3 REPLIES 3
Carlo Henrico_1
Regular Advisor

Re: semaphore

Do a man on ipcs and ipcrm. ipcs shows what aemaphores are in use and ipcrm will clear them.

Good luck

Carlo
Live fast, die young - enjoy a good looking corpse!
Ravi_8
Honored Contributor

Re: semaphore

Hi,

$ipcs
list all IPC
to terminate ipc's kill wouldn't work

to kill semaphores
$ipcrm -s
never give up
Dietmar Konermann
Honored Contributor

Re: semaphore

This is the normal behaviour unless you set SEM_UNDO in your semaphore operations's sem_flg. Only in this case the kernel will perform the undo operation when the process exits. However, complete removal of the semaphore needs to be done explicitely using (signal driven) cleanup functions.

See man semop(2) for more details.

Best regards...
Dietmar.
"Logic is the beginning of wisdom; not the end." -- Spock (Star Trek VI: The Undiscovered Country)