Admin Production ni-theme
Current Publication

SetSleepPolicy

LabWindows/CVI

SetSleepPolicy

int SetSleepPolicy (int sleepPolicy);

Purpose

When the User Interface Library checks for an event from the operating system, it can put your program in the background, to sleep, for a specified period of time. This action gives other applications more processor time, but your program might run more slowly.

Use SetSleepPolicy to set the amount your program sleeps when LabWindows/CVI checks for events. The setting that is optimal for your program depends on the operating system you are using and the other applications you are running. If you think an adjustment is necessary, try the different settings and observe the resulting behavior.

LabWindows/CVI maintains a separate sleep policy for each thread of your program.

Call GetSleepPolicy to get the current sleep policy.

Parameters

Input
Name Type Description
sleepPolicy int Degree to which your program periodically sleeps each time the User Interface Library checks for events from the operating system.

The following lists the valid settings.

Name Code Description
VAL_SLEEP_NONE 1 Never be put to sleep.
VAL_SLEEP_SOME 2 Be put to sleep for a short period.
VAL_SLEEP_MORE 3 Be put to sleep for a longer period.

The default policy is VAL_SLEEP_MORE.

Return Value

Name Type Description
status int Return value indicating whether the function was successful. A negative number indicates that an error occurred.

Additional Information

Library: User Interface Library

Include file: userint.h

LabWindows/CVI compatibility: LabWindows/CVI 4.0 and later

Examples

Refer to the following examples that use the SetSleepPolicy function:

  • userint\custctrl\cviogl\ogldemo.cws

    Open example
  • userint\custctrl\cviogl\ogldraw.cws

    Open example
  • userint\custctrl\cviogl\simple.cws

    Open example