> [...]
> Why is the event still hanging around? I know there are other ways to
> detect if a process is running or not but I want to know why this
> won't work.
I don't know the answer to your question. It's unlikely (but not
impossible) that most anyone else would know either, without seeing a
concise-but-complete code sample that reliably demonstrates the problem.
A few people might have the answer off the top of their head, based on
their prior knowledge of how named events work. But you haven't given
anyone much to go on.
That said, the more usual way to deal with this is to use a named Mutex.
That should work fine and is IMHO the way to go.
Pete
Dilip - 13 Mar 2008 18:52 GMT
On Mar 13, 12:39 pm, "Peter Duniho" <NpOeStPe...@nnowslpianmk.com>
wrote:
> > [...]
> > Why is the event still hanging around? I know there are other ways to
[quoted text clipped - 7 lines]
> their prior knowledge of how named events work. But you haven't given
> anyone much to go on.
Peter
Thanks for responding. I figured out the problem. While doing
OpenExisting from other applications, I didn't wrap the calls around
using block. Consequently it left the handles open, so I couldn't
reliably detect whether app_1 was running or not. In my defense, I
never used the return values of the OpenExisting calls, so I for some
reason mistakenly thought the handle count wouldn't be bumped. I
thought:
EventWaitHandle ewh = EventWaitHandle.OpenExisting(........);
only will increment the handle count of the event.
Obviously I was wrong.