[Subject Prev][Subject Next][Thread Prev][Thread Next][Subject Index][Thread Index]

Re: pthread_delay_np

vinay mahadik wrote:

Of course, but I want only a specified thread to wait for that specified
time. Doesn't sleep etc relate to processes rather than threads? This
seemingly simple requirement seems quite difficult to achive with
pthreads. I have been thinking of SIGALRM; but too gets messy since
signal handlers will be shared and all threads have different masks. And
I have two threads which need to (parallely and independently) sleep for
different time intervals. ANy neat way of doing this?

In Linux, thread = process that shares address space with other processes.
So when the thread calls sleep, only the calling thread sleeps, not the whole

The things unique about Linux implementation is - threads and processes are
peers, rather than the traditional UNIX way of "a process contains threads".