🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: synchronizing access to named mutexes

#11124
From: Dennis Jones
Date: Sat, 28 Feb 2004 16:10
37 lines
2642 bytes
"Remy Lebeau (TeamB)" <gambit47.no.spam@no.spam.yahoo.com> wrote in message
news:403f8f1c@newsgroups.borland.com...
>
> "Dennis Jones" <djones@nospam.com> wrote in message
> news:403f6f4c$1@newsgroups.borland.com...
>
> > No, I don't think so...if the DLL waits on the mutex before the
> > EXE has opened a handle to it, the wait call will succeed
> > immediately because the DLL will already have ownership of
> > the mutex (because it created it).
>
> That is not what Bob was suggesting.  Have the DLL create a second object,
> such as an event object via CreateEvent() that is initially unsignalled.
> Then have the EXE open that same event and signal the event when the EXE
is
> ready.  The DLL can wait for the event to be signalled before doing
anything
> else with the EXE.

I certainly didn't read that into Bob's message, but it was an awfully good
suggestion -- and it worked beautifully.  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?

Given that the event worked, and that it seems likely that a mutex would
work the same way, it seems odd to me that one could not open a mutex, set
it to the signaled state, and then have another process open a handle to
that same mutex and have a wait succeed.  Maybe I should take another look
at my code; it could be that when I tried this with a mutex I opened it in
the non-signaled state thereby preventing the other process's wait from
succeeding.

Thanks,

- Dennis
Technical Details
Message-ID: <4040bd56$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>

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 08:37:06 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>
Subject: Re: synchronizing access to named mutexes
Date: Sat, 28 Feb 2004 08:10:00 -0800
Lines: 39
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: <4040bd56$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1077984598 204.200.27.7 (28 Feb 2004 08:09:58 -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