pthread sleep linux

Steveng picture Steveng · Sep 3, 2010 · Viewed 78.3k times · Source

I am creating a program with multiple threads using pthreads.

Is sleep() causing the process (all the threads) to stop executing or just the thread where I am calling sleep?

Answer

caf picture caf · Sep 3, 2010

Just the thread. The POSIX documentation for sleep() says:

The sleep() function shall cause the calling thread to be suspended from execution...