07-23-2010 03:36 PM
All example code have:
digitalReader.SynchronizeCallbacks =
true;I have just encountered a situation which I have to set 'SynchronizeCallbacks' to false for the callback function to be invoked.
What I do not understand is under which condition I should set this variable to false.
07-26-2010 04:34 PM
Hi Norman To,
The SynchronizeCallbacks specifies how events and callback delegates are invoked. The value should be true if events and callbacks are invoked through the Send or Post methods; otherwise, events and callbacks are invoked directly. The default value is true. In some cases, callbacks and event handlers are executed in a different thread than the rest of the program. Therefore, you must take special care when accessing objects that have thread affinity, such as UI controls, from these callbacks and event handlers. For more information, refer to Events, Callbacks, and Thread Safety in Measurement Studio .NET Class Libraries.
07-27-2010 10:09 AM
Does that means if the acquisition is to be performed in a separated thread than the main program (such as a BackgroundWorker), Synchronizedcallbacks should be set to false.