Some courses and learning paths on NI Learning Center may not appear on learner dashboards. Our team is actively investigating.

If you encounter access issues, please contact services@ni.com and include the learner’s name, email, service ID or EA number, and the list of required courses.

LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

When using an asynchronous timer need data protection?

Global variable in asynchronous timer callback function need to protect data?

thank you !

 

 

0 Kudos
Message 1 of 4
(3,527 Views)

Access to global variables in an asynchronous procedure (like a thread or timer)generally requires a synchronization mechanism.

0 Kudos
Message 2 of 4
(3,507 Views)

Asyncronous timers are executed in a separate thread, so they are expected to be running while the user is operating on the user interface and possibly on data collected in timer callback. All this means that you need to protect your data from concurrent access from both the timer thread and the main thread (where the user interface is normally handled) to prevent unexpected  program behaviour.



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
Message 3 of 4
(3,490 Views)

Thank you very much !

0 Kudos
Message 4 of 4
(3,463 Views)