 |
|
|
Topic: Thread Safety of CommEvent Property
|
By: Jacob | Posted on: Jan 21 2011 at 04:30:32 PM | How do you deal with multiple events occurring in rapid succession? If I am in the process of handling an event and a second event occurs before my event handler finishes running, will the value of CommEvent be changed immediately or will the event raising thread wait until my event handler has finished running? | |
By: Support | Posted on: Jan 21 2011 at 08:33:40 PM | When using MSComm32 and you're processing an OnComm event then the CommEvent property can change unexpectedly especially if you call DoEvents within the OnComm event. if you do that then the OnComm event will actually reneter if more events occur and you'll be running nested/reentrant oncomm events as more events occur and eventually get a stack overflow
This is one of the changes we made to our OCX.
With our ocx if you're handling one event then any further events are held in the ocx until your handler is finished. You'll always get the events one after the other.
| |
|