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; }