istudy0 istudy0 - 1 month ago 22
C Question

Does calling sleep() from pthread put thread to sleep or process?

I saw that there is a question about pthread sleep linux

However, when I looked up man page on my linux machine, I see the following.


SYNOPSIS
#include

unsigned int sleep(unsigned int seconds);


DESCRIPTION
sleep() makes the current process sleep until seconds seconds
have elapsed or a
signal arrives which is not ignored.


So my question is that I would like to know which man page I should follow to put the thread sleep. In addition, if both are true, how can I control that?

I can probably write some code to test it but I want to make sure to hear some feedback from other people as well.

Thank you.

Answer

The wording in your man page is likely wrong. Trust the standard and trust the man page on kernel.org. Write to the maintainer of the documentation for your distro and tell him to update the manual pages.

Comments