Article View: borland.public.cppbuilder.nativeapi
Article #2069Re: Need help with Mutex
From: Dennis Jones
Date: Sun, 29 Apr 2007 04:12
Date: Sun, 29 Apr 2007 04:12
20 lines
1869 bytes
1869 bytes
"Bob Gonder" <notbg@notmindspring.invalid> wrote in message news:i717339g3u8esppurihllgq3aj0a5qelig@4ax.com... > Dennis Jones wrote: > >>Perhaps I am mistaken, but it looks to me like the problem is >>obvious...your >>comment says, "Create a mutex with no initial owner", but the code creates >>it owned (conflicts with the comment). Then you attempt to wait for the >>mutex, and 5 seconds later, due to timeout, the exception is thrown. > > The CreateMutex(true) returns with ownership. > The wait() satisfies with pre-ownership to eliminate deadlock. > Drawback is now the mutex is owned twice and should be released twice. I'm intrigued, but my brain is functioning on overload and a lack of sleep (only to get worse in the near future, I'm afraid). Could you please explain how this methodology works to eliminate deadlock? - Dennis
Technical Details
Message-ID:
<46341b0e$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!newspeer1.nwr.nac.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailReferences:
<4633777f$1@newsgroups.borland.com> <4633807b$1@newsgroups.borland.com> <i717339g3u8esppurihllgq3aj0a5qelig@4ax.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,28184df4065864d1 X-Google-Attributes: gid10cc67,public X-Google-Language: ENGLISH,ASCII-7-bit From: "Dennis Jones" <nospam@nospam.com> Newsgroups: borland.public.cppbuilder.nativeapi References: <4633777f$1@newsgroups.borland.com> <4633807b$1@newsgroups.borland.com> <i717339g3u8esppurihllgq3aj0a5qelig@4ax.com> Subject: Re: Need help with Mutex Date: Sat, 28 Apr 2007 21:12:02 -0700 Lines: 22 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.3028 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2900.3028 X-RFC2646: Format=Flowed; Original NNTP-Posting-Host: 71.245.109.58 Message-ID: <46341b0e$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1177819918 71.245.109.58 (28 Apr 2007 21:11:58 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!newspeer1.nwr.nac.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail