BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Wait a signal from another application or thread

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (Native API)
View previous topic :: View next topic  
Author Message
Guest






PostPosted: Thu Mar 24, 2005 3:48 pm    Post subject: Wait a signal from another application or thread Reply with quote



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


Back to top
Remy Lebeau (TeamB)
Guest





PostPosted: Thu Mar 24, 2005 7:50 pm    Post subject: Re: Wait a signal from another application or thread Reply with quote




<Rieve Tulox> wrote


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

Have each thread call CreateEvent(), giving the event object a unique name
string. Have the Controller call OpenEvent() using the same name string.
Then the threads can use WaitForSingleObject() to wait for the event to be
signalled.


Gambit



Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (Native API) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.