🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #1574

Re: My Mutex stupidity - Help please

#1574
From: Bob Gonder
Date: Tue, 17 Jul 2007 15:36
21 lines
1803 bytes
static array? wrote:

>What the heck is wrong with this. I expect to create a deadlock here - but 
>it doesnt happen!

Once you own the mutex, you own it until you release it.
Waiting on a mutex you own always returns,
otherwise you would deadlock.

>HANDLE MutexHandle1 = CreateMutex(NULL, FALSE, c);
>WaitForSingleObject(MutexHandle1, INFINITE);

>HANDLE MutexHandle2 = CreateMutex(NULL, FALSE, c); // note exact same name

<Help>
Two or more processes can call CreateMutex to create the same named mutex. The first
process actually creates the mutex, and subsequent processes open a handle to the existing
mutex.  </Help>

So, it is a different handle to the same mutex, which you own.
Still no deadlock.
Technical Details
Message-ID: <1vnp93hgcrbt4d9lc2fb5jq2qi6d5obejm@4ax.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!feeder3.cambrium.nl!feeder1.cambrium.nl!feed.tweaknews.nl!62.216.30.27.MISMATCH!newsgate.cistron.nl!xs4all!news2.euro.net!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <469cdda8@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,fca5f87658921108
X-Google-Attributes: gid10cc67,public,usenet
X-Google-Language: ENGLISH,ASCII-7-bit
From: Bob Gonder <notbg@notmindspring.invalid>
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: Re: My Mutex stupidity - Help please
Date: Tue, 17 Jul 2007 08:36:36 -0700
Organization: MindSpring Enterprises, Inc.
Reply-To: notbg@notmindspring.invalid
Message-ID: <1vnp93hgcrbt4d9lc2fb5jq2qi6d5obejm@4ax.com>
References: <469cdda8@newsgroups.borland.com>
X-Newsreader: Forte Agent 1.93/32.576 English (American)
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 67.77.147.201
X-Trace: newsgroups.borland.com 1184686591 67.77.147.201 (17 Jul 2007 08:36:31 -0700)
Lines: 24
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!feeder3.cambrium.nl!feeder1.cambrium.nl!feed.tweaknews.nl!62.216.30.27.MISMATCH!newsgate.cistron.nl!xs4all!news2.euro.net!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail