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.
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?
The crows maintain that a single crow could destroy the heavens. Doubtless this is so. But it proves nothing against the heavens, for the heavens signify simply: the impossibility of crows.