Subj : Re: SEM_UNDO substitute on windows To : comp.programming.threads From : Torsten Robitzki Date : Mon May 23 2005 07:11 pm deepesh.g@gmail.com wrote: > Thanks for your response. > I am using semaphores to check if an application is already running > (application tries to acquire lock on a semaphore and if times out, it > must have been acquired by another instance of the application). In > case if this application exits (May be user exits which is very good > and may be because windows decides that it must be crashed now and > thats where the requirement for SEM_UNDO) the semaphore operations it > did must be undone so that another instance of application would be > able to acquire lock on this semaphore and go ahead with execution. I > would be happy to get any robust solution for this problem, but somehow > I imagined that using semaphores would be a good solution (until I > realize that SEM_UNDO is not supported on windows). Any input is > welcome. I'm not used to the WIN32 API but I've heard of others solving this problem with a named mute. Have a look at CreateMutex() in MSDN. best regards Torsten .