Semaphore Usage Problem
| Newsgroups | gmane.comp.mozilla.devel.nspr |
|---|---|
| Organization | http://groups.google.com |
| Message-ID | <347a83c4-46d1-453c-a100-54e5a3572b39@s19g2000prg.googlegroups.com> |
I am using PRSem for managing various resources in my application. As these semaphores has kernel persistence, I run into a problem now and then. If my program terminates abruptly, the next time I start the program, it may wait forever on one of the semaphores created by previous execution which had been terminated abruptly. My question is how can I recover from this without restarting the system. Is there any strategy to use semaphores? One answer can be: Dont terminate program abruptly. But I have to sometime. If I am debugging or doing something, I do terminate. More over, If my program crashes due to some coding error, the user may not want to restart the whole system.