xHarbour Reference Documentation > Function Reference xHarbour Developers Network  

ThreadSleep()

Puts a thread to sleep.

Syntax

ThreadSleep( <nMilliSeconds>, [<lNoCpu>] ) --> NIL

Arguments

<nMilliSeconds>
This is a numeric value indicating the period of time to suspend the current thread. The unit is 1/1000th of a second.
<lNoCpu>
The parameter defaults to .F. (false) so that the thread resumes after <nMilliSeconds> have elapsed. When set to .T. (true), the thread resumes when a new event is placed into the thread's message queue on the operating system level. During this stage, the thread consumes no CPU resources.

Return

The function returns always NIL.

Description

Function ThreadSleep() is used to suspend the current thread for a defined period of time. This is useful, for example, when a thread should check some status variables periodically and process data only if the status has changed.

If the second parameter is set to .T. (true), the thread ignores <nMilliSeconds> an resumes only after a message is put into the thread's message queue by the operating system.

Note:  this function is also available in single threaded applications.

Info

See also:Inkey(), SecondsSleep(), StartThread(), WAIT
Category: Multi-threading functions , xHarbour extensions
Source:vm\thread.c
LIB:xhbmt.lib
DLL:xhbmtdll.dll


Copyright © 2006-2007 xHarbour.com Inc. All rights reserved.
http://www.xHarbour.com
Created by docmaker.exe