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 

Waiting for an event...

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





PostPosted: Tue Sep 21, 2004 10:08 pm    Post subject: Waiting for an event... Reply with quote



Hi & thanks for reading...

I am using C++Builder 5.0 with TComPort component by Dejan Crnila.

TComPort apparently creates its' own thread for events such as
OnRxChar. The debugger proves this point. I've set the TComPort
monitoring thread to the highest priority and I presume my primary vcl
thread is at the normal priority. I am trying to do something like the
following:

// main form constructor snippett: create an event with manual
signaling
// (lpszRxcharEvent is public in TFormMain)
LPCTSTR lpszRxcharEvent = "RXCHAR EVENT";
RxCharEventHandle = CreateEvent(NULL, TRUE, FALSE,
lpszRxcharEvent);

// TComPort OnRxChar event: manually signal the event when message
recevied
// (highest thread priority)
SetEvent(RxCharEventHandle);
...lots of processing


// code from a modal form launched from the TMainForm (vcl thread):
Wret = WaitForSingleObject(FormMainLog->RxCharEventHandle, 2500);

I call ResetEvent(RxCharEventHandle) just prior to sending a message
awaiting a response from an embedded device.

Now Wret is alway 258 (WAIT_TIMEOUT)...I know serial data has arrived
during the exaggerated 2.5 second delay as I can see it on the
o'scope. Why wouldn't the OnRxChar event trigger?

Basically, I want the VCL thread to wait during a certain part of the
program for an event or timeout in ~250 ms.

Thanks in advance,
Rich
Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (WinAPI) 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.