🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Wait for "signal" from another application and/or thread

#8987
From: Bob Gonder
Date: Sat, 14 Aug 2004 01:25
34 lines
2713 bytes
Eugene Mayevski [SecureBlackbox] wrote:

>Bob Gonder wrote:
>
>>>How to make sure that each and every one of the waiting thread be signalled?
>> You already create the event to not reset, so if you don't reset the
>> event in your thread code, then all threads will get the event signal.
>
>If the event is auto-reset, they will get it either anyway. The 
>difference between semaphore and event is that semaphore awakes one 
>listener and decrements semaphore by 1. And event awakes all listeners 
>and then is reset. So the OP should use semaphores.

Did I read this wrong?
"CreateEvent()
bManualReset
Specifies whether a manual-reset or auto-reset event object is
created. If TRUE, then you must use the ResetEvent function to
manually reset the state to nonsignaled. If FALSE, Windows
automatically resets the state to nonsignaled after a single waiting
thread has been released. "

Sounds like, if TRUE, all threads (and the OP had several waiting on
the same event) will signal, and if FALSE, only One will signal.
Either that, or the Docs are wrong.

Ahh, perhaps you were recommending Named Semaphores so that all
threads in all instances of the program could all release with a
single call?
For that, I suppose he'd need to use WaitMultiple, and the Named
Semaphore would be essentially a Kill Notification (Thread gets it and
self-terminates)  Using the current process-level events for rerunning
the threads. (Or a second local semaphore so he could restart a given
number of threads with one call.)
Technical Details
Message-ID: <pboqh013avflntd8vgj1vcbrg000u94vb7@4ax.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!213.200.89.82.MISMATCH!tiscali!newsfeed1.ip.tiscali.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <4105617c$1@newsgroups.borland.com> <4105777f$3@newsgroups.borland.com> <411ccf89@newsgroups.borland.com> <gnsph0pq4c8mfhapah6cideqmbp6gqor5r@4ax.com> <411d2245@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,b6552239fe09c315
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: Bob Gonder <notbg@notmindspring.invalid>
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: Re: Wait for "signal" from another application and/or thread 
Date: Fri, 13 Aug 2004 18:25:46 -0700
Organization: MindSpring Enterprises, Inc.
Reply-To: notbg@notmindspring.invalid
Message-ID: <pboqh013avflntd8vgj1vcbrg000u94vb7@4ax.com>
References: <4105617c$1@newsgroups.borland.com> <4105777f$3@newsgroups.borland.com> <411ccf89@newsgroups.borland.com> <gnsph0pq4c8mfhapah6cideqmbp6gqor5r@4ax.com> <411d2245@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: 65.40.118.193
X-Trace: newsgroups.borland.com 1092446742 65.40.118.193 (13 Aug 2004 18:25:42 -0700)
Lines: 36
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!213.200.89.82.MISMATCH!tiscali!newsfeed1.ip.tiscali.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail