🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Wait a signal from another application or thread

#6932
From: Rieve Tulox
Date: Thu, 24 Mar 2005 15:48
23 lines
1621 bytes
Hello,
My question is about how to implement "A wait for signal".
Assume that we have a thread class TMyThread drived from a TThread and its 
Execute method is as following code

void __fastcall TMyThread::Execute(void)
{
  while(!Terminated) {
     // Do something
     WaitSignalFromControllerApplication || Terminated
  }//while(!Terminated)
}

TMyThread will wait until terminated or until it receive a particular signal 
from another controller application or from another controller thread.
We may have multiple intances of the TMyThread and we want ALL instances be 
signalled by the controller application. Controller has no knowledge about 
the number of waiting threads.

How can we implement this "wait" logic? Can you give some examples?

Thx
Rieve Tulox
Technical Details
Message-ID: <4242e142$2@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news.glorb.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,ff95df89dd87ac92,start
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: <Rieve Tulox>
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: Wait a signal from another application or thread 
Date: Fri, 25 Mar 2005 02:48:05 +1100
Lines: 25
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
X-RFC2646: Format=Flowed; Original
NNTP-Posting-Host: 211.30.60.151
Message-ID: <4242e142$2@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1111679298 211.30.60.151 (24 Mar 2005 07:48:18 -0800)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news.glorb.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail