Web forum is in read-only mode. Login as active registered customer for write access
  Forum Search   New Posts New Posts

Purpose of SyncThreads

 Post Reply Post Reply
Author
Roberts Tim View Drop Down
New Member
New Member
Avatar

Joined: 17 Jul 2013
Posts: 22
Post Options Post Options   Quote Roberts Tim Quote  Post ReplyReply Direct Link To This Post Topic: Purpose of SyncThreads
    Posted: 08 Nov 2018 at 8:33pm
I am interested to know when the SyncThreads property should be used. I notice that it is set to True by default. I have read through the source code and I see that this wraps the event generators in Synchronize calls. Presumably this is done so that it is safe to update GUI components from inside events such as OnRxChar. Is that correct?

In which case is it only safe to set it to False if the event handler code is thread safe?

The reason I ask is that I sometimes experience very choppy performance when SyncThreads is True. The device is transmitting 15 data packets per second. For testing I am decoding the data packet and writing it to the console window. With SyncThreads on, the updates are sporadic. With SyncThreads off, it is perfectly regular.
Back to Top
Bruno Fierens View Drop Down
TMS Support
TMS Support
Avatar

Joined: 11 May 2010
Posts: 6901
Post Options Post Options   Quote Bruno Fierens Quote  Post ReplyReply Direct Link To This Post Posted: 08 Nov 2018 at 10:39pm
The reason is indeed for safe synching with UI updates, i.e. you can always update UI from the events without needing to write yourself any additional synchronize code. When doing so and there are lengthy UI operations, this can of course affect the serial communication itself. 
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down