Thread sleep [Archive] - C Board

PDA

View Full Version : Thread sleep


quagsire
11-29-2002, 02:18 AM
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.

quagsire
11-29-2002, 07:00 AM
I used the following :

struct timespec timeout = {10, 0 };
pthread_delay_np( &timeout );

Unfortunately it is not portable, but I will always use it on the same platform (IBM AIX)

IfYouSaySo
12-09-2002, 02:42 PM
I have seen nanosleep used to emulate pthread_delay_np on linux. Threads are processes on linux anyway, so what are you worried about?