01-07-2011 12:46 AM
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
01-07-2011 01:11 AM
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 ![]()
Wolfgang
01-07-2011 01:46 AM
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
01-07-2011 09:18 AM
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.