I changed from semaphore to mutex. Works fine, thanx a lot.
that they can be used across processes.
"Terrence" wrote:
> If you need to know that a process was terminated, get the HANDLE for the
> process and use that to wait.
> Instead of using a semaphore with count 1, use a mutex, because
> WAIT_ABANDONED will be returned in the event that the mutex-holder is
> terminated.
> A semaphore is not "held" like a mutex is held. It is just a
> waitable-atomic-counter.
> "nrieger" <nrie...@discussions.microsoft.com> wrote in message
> news:A77D8544-DD8F-4EC6-A6B9-565B6C0158D3@microsoft.com...
> > Hi,
> > I'm using several semaphores (max val 1) for IPC:
> > hnd = CreateSemaphore (NULL, 1, 1, "SEM-1");
> > ....
> > result = WaitForSingleObject(hnd, INFINITE);
> > If a process is killed or stopped while it holds the semaphore (val=0),
> the
> > semaphore is not incremented by Windows (process cleanup ?).
> > Doesn't windows cleanup (increment semaphore by process' descrements) on
> > process termination ?
> > I'm using Windows XP, 2000, 2003 Server, each process is a "console
> > Application" developed with VC++ 6.0.
> > Each assistance is welcome and appreciated.
> > Thanx a lot.