From 82ba818ff456bcd6d56a06226e3f27e98fbb55c3 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Thu, 14 Aug 2025 22:58:58 -0500 Subject: removing all downloaded devdocs files --- devdocs/c/thread%2Fthrd_sleep.html | 36 ------------------------------------ 1 file changed, 36 deletions(-) delete mode 100644 devdocs/c/thread%2Fthrd_sleep.html (limited to 'devdocs/c/thread%2Fthrd_sleep.html') diff --git a/devdocs/c/thread%2Fthrd_sleep.html b/devdocs/c/thread%2Fthrd_sleep.html deleted file mode 100644 index 2c7cd59a..00000000 --- a/devdocs/c/thread%2Fthrd_sleep.html +++ /dev/null @@ -1,36 +0,0 @@ -

thrd_sleep

Defined in header <threads.h>
int thrd_sleep( const struct timespec* duration,
-                struct timespec* remaining );
-
(since C11)

Blocks the execution of the current thread for at least until the TIME_UTC based duration pointed to by duration has elapsed.

-

The sleep may resume earlier if a signal that is not ignored is received. In such case, if remaining is not NULL, the remaining time duration is stored into the object pointed to by remaining.

-

Parameters

- - -
duration - pointer to the duration to sleep for
remaining - pointer to the object to put the remaining time on interruption. May be NULL, in which case it is ignored

Return value

​0​ on successful sleep, -1 if a signal occurred, other negative value if an error occurred.

-

Notes

duration and remaining may point at the same object, which simplifies re-running the function after a signal.

-

The actual sleep time may be longer than requested because it is rounded up to the timer granularity and because of scheduling and context switching overhead.

-

The POSIX equivalent of this function is nanosleep.

-

Example

#include <threads.h>
-#include <time.h>
-#include <stdio.h>
- 
-int main(void)
-{
-    printf("Time: %s", ctime(&(time_t){time(NULL)}));
-    thrd_sleep(&(struct timespec){.tv_sec=1}, NULL); // sleep 1 sec
-    printf("Time: %s", ctime(&(time_t){time(NULL)}));
-}

Output:

-
Time: Mon Feb  2 16:18:41 2015
-Time: Mon Feb  2 16:18:42 2015

References

See also

- -
-
(C11)
yields the current time slice
(function)
C++ documentation for sleep_for
-

- © cppreference.com
Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.
- https://en.cppreference.com/w/c/thread/thrd_sleep -

-
-- cgit v1.2.3