LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Is there any why to use sleep();

I'm trying to use sleep(); and I keep getting an error saying that I'm missing prototype, can I not use sleep(); with labwindows?  If I can't use sleep(); what should I use?

Discover0
0 Kudos
Message 1 of 4
(7,547 Views)

sleep (and usleep) are part of the POSIX standard, not ANSI. Because of this, they are not available in CVI. This is because the 'sleep and yield' behavior is implemented in a platform specific way. CVI provides Delay, but this is a busy wait and probably not what you want. You can call Sleep on Windows via the win32 SDK; just include windows.h.

Hope this helps,

-alex

Message 2 of 4
(7,545 Views)

Delay was exactly what I was looking for thanks.

Discover0
0 Kudos
Message 3 of 4
(7,537 Views)

Delay eats up CPU time.  The Windows SDK Sleep function does not.  Just include windows.h and call Sleep.

See the knowledgebase article here:

http://digital.ni.com/public.nsf/allkb/249E22A8822445D386256D9D0056D00E

Message 4 of 4
(7,429 Views)