How do you make a specific thread sleep without sleeping the process.
If I use sleep, it sleeps the whole process, not just the specific thread I want.
Printable View
How do you make a specific thread sleep without sleeping the process.
If I use sleep, it sleeps the whole process, not just the specific thread I want.
I used the following :
Unfortunately it is not portable, but I will always use it on the same platform (IBM AIX)Code:struct timespec timeout = {10, 0 };
pthread_delay_np( &timeout );
I have seen nanosleep used to emulate pthread_delay_np on linux. Threads are processes on linux anyway, so what are you worried about?