Article View: borland.public.cppbuilder.nativeapi
Article #15899Re: Mutex and program instancenumbers
From: Eudy Carvalhaes C. Silva
Date: Fri, 06 Jun 2003 17:03
Date: Fri, 06 Jun 2003 17:03
29 lines
2153 bytes
2153 bytes
According to the online help (CreateMutex) "The system closes the handle automatically when the process terminates". So, as long as there are no other opened handles to the mutex, it will be destroyed. In Hans' case the handles opened in calls to OpenMutex in other instances (and not closed) are preventing the mutex destruction. Even if the instance that created the mutex calls CloseHandle, it will not be destroyed. I agree, though, that CloseHandle should be used instead of ReleaseMutex. But in this particular case it wouldn't fix the problem. Eudy Remy Lebeau (TeamB) wrote: > You should be calling CloseHandle(), not ReleaseMutex(). Your clients are > not obtaining the instance numbers correctly because the original mutexes > are never getting freed correctly, thus they still exist for future client > instances to find even though the earlier instances are long gone. > ReleaseMutex does not free the mutex, it releases the lock on the mutex if > you use one of the WaitFor...() API functions to obtain the lock. > > > Gambit > >
Technical Details
Message-ID:
<3EE0C957.8080103@iae.cta>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-01!sn-xit-09!supernews.com!newshosting.com!news-xfer2.atl.newshosting.com!nntp-relay.ihug.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailReferences:
<3ee0b2cd@newsgroups.borland.com> <3ee0c4a0@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10cc67,aeacbe3cdfad6f92 X-Google-Attributes: gid10cc67,public X-Google-ArrivalTime: 2003-06-06 10:10:09 PST Message-ID: <3EE0C957.8080103@iae.cta> Date: Fri, 06 Jun 2003 14:03:19 -0300 From: "Eudy Carvalhaes C. Silva" <eudy@iae.cta> User-Agent: Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.0.2) Gecko/20021120 Netscape/7.01 X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: borland.public.cppbuilder.nativeapi Subject: Re: Mutex and program instancenumbers References: <3ee0b2cd@newsgroups.borland.com> <3ee0c4a0@newsgroups.borland.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 161.24.47.98 X-Trace: newsgroups.borland.com 1054918867 161.24.47.98 (6 Jun 2003 10:01:07 -0700) Lines: 30 Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-01!sn-xit-09!supernews.com!newshosting.com!news-xfer2.atl.newshosting.com!nntp-relay.ihug.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail