LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Does the Timer() function support multithread?

Hello,

 

In my application, there would be more than 1000 conversations to be monitored. I am going to design a woker thread for each conversation to determine the timeout of the communication, so I must using the timer mechanism. Due to just can create (max )16 async timers, so I want to use Timer() in the worker thread. I'd like to know if the function support multithread and if it will not be disturbed in a thread?

 

 

David

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

Hi David,

 

All CVI libraries including UI are supposed to be thread-safe. Concerning the timers, the help on 'Programming with Timer Controls' says that the number of timer controls you can use is unlimited, but timer callbacks are called sequentially (i.e. they don't interrupt each other)...

 

Have fun with 1000 timers Smiley Wink

 

Wolfgang

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

Hi Walfgang,

 

My application not have any panel, so the timer control I will never to use. What I means is that want to understand the usage of the "Timer()" functiuon in a worker thread.

 

 

 

David

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

Hi David,

 

The 'timer' used by the Timer() function is global and not thread specific. Note that Timer() returns the number of seconds elapsed since the FIRST call to the Timer() function. This is independent of the thread where the FIRST and current calls take place. So, the values returned are kind of a global 'time' since the first Timer() call in your program. I would recommend that you FIRST call Timer() in your main thread before running your other threads and then the other values returned in any thread are the 'seconds' since this call.

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