LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Async timer and mutexes ?

Solved!
Go to solution

Hello all,

I rarely used async timers, but now I do need them.

They run in a separate thread, right ?

Meaning in some cases I need to use mutexes or critical sections ?

 

I don't remember seeing functionnality for those in CVI. I normally use the pthread library on Linux, so I don't know what you guys recommand in CVI.

Thanks.

0 Kudos
Message 1 of 3
(3,751 Views)

Hi,

 

The thing is, if you have multiple async timers, they all run in the same thread.

So you may somewhat lose its accuracy if you have many of them running at the same time.

(We have encountered this before)

 

As in all multithread scenarios you have to protect your global data from simultaneous access.

We have used Thread-safe variables (TSV) alot with success.

You may try them if you haven't before..

 

Regards,

S. Eren BALCI
IMESTEK
0 Kudos
Message 2 of 3
(3,749 Views)
Solution
Accepted by topic author gdargaud

In addition to ebalci notes, take a look at this documentation on multithreading:

CVI comes with a full set of instruments to exchange and protect data across threads: beyond TSV already mentioned by ebalci you can can count for example on locks and Thread Safe Queues.



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?
0 Kudos
Message 3 of 3
(3,745 Views)