summaryrefslogtreecommitdiffstats
path: root/cpukit/posix/src/nanosleep.c
diff options
context:
space:
mode:
Diffstat (limited to 'cpukit/posix/src/nanosleep.c')
-rw-r--r--cpukit/posix/src/nanosleep.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/cpukit/posix/src/nanosleep.c b/cpukit/posix/src/nanosleep.c
index a7fc8d6e97..47f7cbad0e 100644
--- a/cpukit/posix/src/nanosleep.c
+++ b/cpukit/posix/src/nanosleep.c
@@ -54,6 +54,13 @@ int nanosleep(
ticks = _POSIX_Timespec_to_interval( the_rqtp );
/*
+ * Bump the ticks by one so the delay is at least the number of
+ * ticks requested
+ */
+ ticks++;
+
+ /*
+ * A nanosleep for zero time is implemented as a yield.
* This behavior is also beyond the POSIX specification but is
* consistent with the RTEMS api and yields desirable behavior.
*/
@@ -69,6 +76,9 @@ int nanosleep(
return 0;
}
+ /*
+ * Block for the desired amount of time
+ */
_Thread_Disable_dispatch();
_Thread_Set_state(
_Thread_Executing,