Re: Detecting a running application
From: Martin Harvey (Demon account) (martin_at_nospam_pergolesi.demon.co.uk)
Date: 08/31/04
- Next message: Martin Harvey (Demon account): "Re: Detecting a running application"
- Previous message: Martin Harvey (Demon account): "Re: Infinite loop outside code"
- In reply to: David Reeve: "Re: Detecting a running application"
- Next in thread: Rob Kennedy: "Re: Detecting a running application"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Tue, 31 Aug 2004 18:25:32 GMT
On Sun, 29 Aug 2004 02:54:45 GMT, "David Reeve"
<dree4456@big-pond.net.au> wrote:
>Sure, but look at the code in the FAQ, and you can make it even simpler than
>this, so that the call to ReleaseMutex immediately follows the CreateMutex
>call, and it fails. It doesn't greatly concern me since I'm not using it,
>just that narking feeling you get when help doesn't seem to line up with
>reality.
Well yes, because ReleaseMutex isn't necessarily the opposite of
CreateMutex ... unless you're requesting initial ownership.
In General:
CreateMutex <-> CloseHandle;
WaitForXXXX <-> ReleaseMutex;
>If you're saying what I think you're saying. then I disagree. The mechanism
>being used to block the second instance is not the mutexes mutual
>exclusivity, but simply the fact it is a global object.
Yes- in fact, I wouldn't even use the exclusivity - all you need to
use is any global names object where the Win32 API supports atomic
"create and see if already exists" semantics. - A mutex is one of
many. Actually, if the API call sets the Win32 last error code
"already exists", then I'd far prefer to use "GlobalAddAtom" instead,
as something far more appropriate.
>Yep... 'but it works' has got to be one of the more hazardous statements in
>the programming art..... one day, I keep promising myself, I really will dot
>every 'i' and cross every 't'.... one day.
I now have an internal search & replace algorithm, where, when anyone
says "it works", my brain substitutes "it works, but it stinks".
MH.
- Next message: Martin Harvey (Demon account): "Re: Detecting a running application"
- Previous message: Martin Harvey (Demon account): "Re: Infinite loop outside code"
- In reply to: David Reeve: "Re: Detecting a running application"
- Next in thread: Rob Kennedy: "Re: Detecting a running application"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]