🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: synchronizing access to named mutexes

#11035
From: Dennis Jones
Date: Sun, 29 Feb 2004 00:41
28 lines
2404 bytes
"Remy Lebeau (TeamB)" <gambit47.no.spam@no.spam.yahoo.com> wrote in message
news:40411615$1@newsgroups.borland.com...
>
> "Dennis Jones" <djones@nospam.com> wrote in message
> news:4040bd56$1@newsgroups.borland.com...
>
> > And now that I think
> > about it, I might have been able to do the same thing with one of my
> > mutexes too.  After all, I was able to wait on the event handle before
> > the EXE had opened its own handle to it -- so why not a mutex?
>
> I do not recommend a mutex.  The DLL cannot wait for the EXE to signal a
> mutex as easily as it can an event.  As soon as the DLL creates the mutex,
> it would usually end up obtaining ownership of the mutex before the
> application could open it.  Thus the EXE would be waiting on the DLL, not
> the other way around.  An event is better suited for this task instead.

Yes, I see your point.  After thinking about this a little bit more, I can
see that even if the DLL created the mutex without ownership, as soon as it
waited on the mutex (believing that it was waiting on the EXE), it would
immediately gain ownership, thereby preventing the EXE from obtaining
ownership, which of course is required in order to release it!

An event is perfectly suited to the task and that's what I've done.  Thanks
for the suggestion.

- Dennis
Technical Details
Message-ID: <40413547$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!nntp-relay.ihug.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
References: <403ea9c9$1@newsgroups.borland.com> <dhnu305gp72fdko73lfr2ckr0ps4l7ltf5@4ax.com> <403f6f4c$1@newsgroups.borland.com> <403f8f1c@newsgroups.borland.com> <4040bd56$1@newsgroups.borland.com> <40411615$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,147e3de49808f5a
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2004-02-28 16:46:19 PST
From: "Dennis Jones" <djones@nospam.com>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <403ea9c9$1@newsgroups.borland.com> <dhnu305gp72fdko73lfr2ckr0ps4l7ltf5@4ax.com> <403f6f4c$1@newsgroups.borland.com> <403f8f1c@newsgroups.borland.com> <4040bd56$1@newsgroups.borland.com> <40411615$1@newsgroups.borland.com>
Subject: Re: synchronizing access to named mutexes
Date: Sat, 28 Feb 2004 16:41:46 -0800
Lines: 30
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
NNTP-Posting-Host: 204.200.27.7
Message-ID: <40413547$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1078015303 204.200.27.7 (28 Feb 2004 16:41:43 -0800)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!nntp-relay.ihug.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail