 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
R. Bair Guest
|
Posted: Tue Sep 21, 2004 10:08 pm Post subject: Waiting for an event... |
|
|
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 |
|
 |
|
|
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
|
|