LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Does the delay function suspend the thread, or is it in a busy loop?

This is probably a really basic question, but I have two threads going. There are also outside events that I need to wait for (for a phone line connection through a router to timeout - CICSO tells me that's the only way to disconnect).

I'm using the CVI Delay function to wait for the timeout (I know how long it is). When I use Delay, am I eating up CPU time, or does Delay suspend the CVI task and let other windows stuff execute?

thanks-
Lorrie Smith
0 Kudos
Message 1 of 4
(3,558 Views)
No, the Delay function means that thread is sleeping and is not using CPU time. Your main thread still could be using time, but that thread is not.

Best Regards,

Chris Matthews
National Instruments
0 Kudos
Message 2 of 4
(3,558 Views)
Hi,
that's not what I saw when using the Delay(..) function. When executing a Delay on a CVI GUI callback function, all other activities of the current executing CVI application freezed! It looks like the CVI appl is sleeping and not just the thread that executes the Delay(..)

groeten (regards) Tom
0 Kudos
Message 3 of 4
(3,558 Views)
You must be doing something wrong with your threading. I have done this many times and Delay() definately puts the other thread to sleep. I attached an example that demonstrates this. It has a timer control updating a numeric every millisecond. There is a button that creates a new thread and runs delay for 10 seconds. You will see that it does not effect the main thread and the timer keeps updating the numeric control while the delay is running.

It's written in CVI 6.0, hopefully that is the version you have. If not, look at the source code and try it in your version (should be 5.5 or above).

Best Regards,

Chris Matthews
National Instruments
0 Kudos
Message 4 of 4
(3,558 Views)