Automatic Semaphore release on process Exit
问题 I am using Semaphore to limit the number of concurrent instances my application can run. There are many ways a process can terminate. Can the Semaphore be created so it automatically releases upon process exit? EDIT: I would like some magic to automatically clean up the semaphore 'raised' state for the process owning it upon exit or crash. Just to be sure that it is cleared, no matter what. MORE: I am looking for any viable option for it, considering: it would be great that NO external