Re: pthread and nanosleep
- From: Szabolcs Ferenczi <szabolcs.ferenczi@xxxxxxxxx>
- Date: Mon, 10 Dec 2007 03:00:03 -0800 (PST)
DUDULE wrote:
I do not understand why. It seems like nanosleep suspends all the threads
(not only the calling one).
You can consider using sched_yield instead of nanosleep:
1,3d0
< struct timespec duree_nanosleep, duree_out;
< duree_nanosleep.tv_sec=0;
< duree_nanosleep.tv_nsec=10000000; //10 ms
13,14c10
< // if I comment out this line, the program is much faster.
< nanosleep(&duree_nanosleep,&duree_out);
---
sched_yield();
But a tricky code remains a tricky one.
Best Regards,
Szabolcs
.
- Follow-Ups:
- Re: pthread and nanosleep
- From: Chris Friesen
- Re: pthread and nanosleep
- References:
- pthread and nanosleep
- From: DUDULE
- pthread and nanosleep
- Prev by Date: Re: Many threads in Linux
- Next by Date: Re: pthread and nanosleep
- Previous by thread: pthread and nanosleep
- Next by thread: Re: pthread and nanosleep
- Index(es):