you can put the thread to sleep in the loop, to let other thread do their work
for windows:
void my_sleep( uint32 milli_seconds )
{
Sleep( (DWORD)milliseconds );
}
for linux:
#include <sys/time.h>
void my_sleep( uint32 milli_seconds )
{
struct timeval t;
t.tv_sec= milli_seconds / 1000L;
t.tv_usec= ( milli_seconds % 1000L ) * 1000L;
select(0,0,0,0,&t); // sleep
}
ike
Main Topics
Browse All Topics





by: WanderinglazyeyePosted on 2007-11-09 at 21:22:38ID: 20254718
In other words, if I don't want to use a thread, how can I call a second code routine from the first routine without having to wait for the second code routine to return in order to terminate or reloop the first routine?