Sack Library Documentation
ContentsIndexReferenceHome
PreviousUpNext
sack::timers::WakeableSleepEx Function
C++
IMPORT_METHOD void WakeableSleepEx(_32 milliseconds DBG_PASS);
IMPORT_METHOD void WakeableSleep(_32 milliseconds);
Parameters 
Description 
dwMilliseconds 
How long to sleep. Can be indefinite if value is SLEEP_FOREVER

Sleeps a number of milliseconds or until the thread is passed to WakeThread.

PTHREAD main_thread;
   
PTRSZVAL CPROC WakeMeThread( PTHREAD thread )
{
   // get the value passed to ThreadTo as user_data.
   PTRSZVAL user_data = GetThreadParam( thread );
   // let the main thread sleep a little wile
    WakeableSleep( 250 );
   // then wake it up
    WakeThread( main_thread );
    return 0;
}
   
int main( void )
{
    // save my PTHREAD globally.
    main_thread = MakeThread();
    // create a thread that can wake us
    ThreadTo( WakeMeThread, 0 );
    // demonstrate sleeping
    WakableSleep( SLEEP_FOREVER );
    return 0;
}
Created with a commercial version of Doc-O-Matic. In order to make this message disappear you need to register this software. If you have problems registering this software please contact us at support@toolsfactory.com.
Copyright (c) 2000+. All rights reserved.
What do you think about this topic? Send feedback!