On 10/11/2006 1:24 PM, Phil M wrote:
> On Oct 11, 2006, at 10:16 AM, Charles Calvert wrote:
> 
>> I assume that you have a corresponding call to Leave in the Close
>> event.  If not, you may leak the mutex (I don't know how RB handles
>> objects owned by processes that terminate).
> 
> A Mutex is suppose to automatically release when it goes out-of-scope.

This isn't the same thing as leaking a mutex.  Much like leaking memory,
an app. that leaks a mutex allocates one but never cleans it up.  The OS
might deallocate it automatically when the app.'s process is terminated,
or it might not, depending on the OS.

If this is the sort of app. that would be run repeatedly during a single
session, that might be a problem under some OS's.

> A crash might prevent a release, but I don't know.  At least on the
> Macintosh, Killing the application with the debugger correctly releases
> the Mutex (and killing an app should be the same result as a crash). 
> But since a Mutex has different implementations for each platform, it
> probably behaves a little different on Windows.

It depends on the version of Windows.  Assuming that it's a Win32 mutex
under the hood, terminating the owning thread will cause it to be
released, but terminating all processes that reference the mutex (i.e.
have a handle to it) will not cause the OS to deallocate the handle, at
least under Win95/98/ME, if memory serves.  The WinNT-derived family
cleans up behind the process better, I believe (though I haven't checked
to be sure).

-- 
Charles Calvert
Celtic Wolf, Inc.
(703) 580-0210
[EMAIL PROTECTED]
http://www.celticwolf.com/

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to