View Single Post
Old 05-22-2010, 02:15 PM   #9
Dale
Banned
 
Join Date: Jun 2005

Location: Western Missouri
Posts: 960
Ralph; what version of Windows (I'm told that Mutex works slightly differently in Windows 7).

Originally posted by Jim Sachs:
All versions of Marine Aquarium have used a technique called a Mutex, which is SUPPOSED to prevent a copy of the program from starting if another is already running. Somehow, you guys are able to get around this, but in looking through (Edgar's) code, I don't see how. .  
Of course, I can't see the code. Presumably you know that a Mutex, by itself, does not prevent a copy of the program from starting -- a Mutex is a mechanism for coordinating (synchronizing) the sharing of resources. Some additional code would be required for the 2nd copy to "commit suicide" if it can't get the resource. At least that's how it normally is coded.

That's not the "intended use" of Mutex (detecting when a program should kill itself). When it works, it works fine - but Mutex implementation can change when operating systems change, and also the "right" way for a program to commit suicide may be different between operating systems.

Of course, I'm making some really broad assumptions about how this is coded. In particular, I'm assuming that it's the responsibility of the "2nd copy" to detect the "problem" and commit suicide.
Dale is offline   Reply With Quote