Subj : Re: Predicate for pthread_cond_timedwait() ?? To : comp.programming.threads From : David Schwartz Date : Thu Mar 17 2005 03:22 pm wrote in message news:1111096787.348777.186010@g14g2000cwa.googlegroups.com... > Thanks so much for your response!!! All good pointers. I may > try nanosleep too -- a bit more code to cover the interrupt case, > but the intent is more obvious. Thanks again! I almost forgot to tell you about 'select'. If you use 'select' with NULL pointers for all the fd sets, it can act as a sleep function too. In order of preference, here's what I suggest: 1) If you're using GNU PTH or something other than pthreads, use its sleep function. 2) If you have 'nanosleep', use it 3) If you're on OSF1 or another OS that has a non-portable sleep function (like 'pthread_delay_np'), use it. 4) If you have 'usleep', use it. (Caution: Likely will not work for times greater than one second, use 'sleep' for that.) In fact, you probably don't want to use 'usleep' or 'sleep'. 5) Use 'select'. DS .