[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Threads question



>I'd highly recommend using the pthread_cond* functions or 
>another mutex. That usage of a timer to control >syncroinization(sp?) 
between two threads is a bad idea.

Right, I use mutex(s) for synchro between threads.  What I need is for a 
thread to wake up every X number of seconds and do it's thing, go back to 
sleep, and do it all over again.  Traditionally I'd just sleep(X) but 
that doesn't work in a thread as is knocks out the whole process.

>>I've been using POSIX threads for quite some time, having taught
>>myself using 
>>"http://centaurus.cs.umass.edu/~wagner/threads_html/tutorial.html".
>>In this tutorial they use a function called pthread_delay_np.  
>>I just tried to use it, and it appears that my RH box doesn't
>>have it.  I need to make a thread sleep for a given qunatity of
>>time, but a call to sleep seems to cause all the threads in the
>>process to sleep.  The only reference I can find to >>pthreads_delay_np 
as it relates specifically to
>>Linux is a VERY old Suse rpm that lists the appropriate man '
>>page as a provided file.  Anyone know the issue with >>pthread_delay_np 
or how to accomplish an equivalent?