🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Waiting for a signal...

#15313
From: Remy Lebeau (TeamB)
Date: Wed, 09 Jul 2003 16:47
20 lines
1876 bytes
"Pang Fu" <nospam_pangfu@hotmail.com> wrote in message
news:3f0c1f49$1@newsgroups.borland.com...

> Say I have two threads in a BCB application. The
> first one will wait for a signal from the second one.

Look at the CreateEvent(), SetEvent() and WaitForSingleObject() functions in
the Win32 API.  Create an event object that both threads have a HANDLE to.
Then the first thread can call SetEvent() and the other thread can call
WaitForSingleObject() to wait until the event is signalled.

> Ans also how this wait/signal works accross the applications?

Same way.  CreateEvent() has an lpName parameter so that you can give the
event object a name.  When multiple threads/processes call CreateEvent()
passing it the same name, they all receive a HANDLE to the same event object
which is then shared between them.


Gambit
Technical Details
Message-ID: <3f0c45fb$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-09!supernews.com!news.maxwell.syr.edu!newsfeed.wirehub.nl!news.kweb.on.ca!newsgroups.borland.com!not-for-mail
References: <3f0c1f49$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,d9da3744324c494c
X-Google-Attributes: gid10cc67,public
X-Google-Thread: 102541,d9da3744324c494c
X-Google-Attributes: gid102541,public
X-Google-ArrivalTime: 2003-07-09 10:03:49 PST
From: "Remy Lebeau \(TeamB\)" <gambit47@yahoo.com>
Newsgroups: borland.public.cppbuilder.nativeapi,borland.public.cppbuilder.students
References: <3f0c1f49$1@newsgroups.borland.com>
Subject: Re: Waiting for a signal...
Date: Wed, 9 Jul 2003 09:47:28 -0700
Lines: 23
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.1106
NNTP-Posting-Host: 207.175.226.26
Message-ID: <3f0c45fb$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1057768955 207.175.226.26 (9 Jul 2003 09:42:35 -0700)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-09!supernews.com!news.maxwell.syr.edu!newsfeed.wirehub.nl!news.kweb.on.ca!newsgroups.borland.com!not-for-mail