#2732 closed defect (fixed)

Add clock_nanosleep()

Reported by: Gedare Bloom Owned by: Gedare Bloom
Priority: normal Milestone: 5.1
Component: posix Version: 5
Severity: normal Keywords: posix
Cc: Blocked By:


The clock_nanosleep function is provided to enable specifying the clock source (CLOCK_REALTIME or CLOCK_MONOTONIC) and to control whether or not to use an absolute or relative reference point via TIMER_ABSTIME flag.

See also: http://pubs.opengroup.org/onlinepubs/009695399/functions/clock_nanosleep.html

Change History (8)

comment:1 Changed on 07/25/16 at 16:45:22 by Gedare Bloom <gedare@…>

In e0f17fcf6f06d3383cd389d809ee4e3d6e0fb14d/rtems:

posix: fix clock_nanosleep and nanosleep clock use

Sleeping with CLOCK_REALTIME should use the WATCHDOG_ABSOLUTE
clock discipline for the threadq so that the timeout interval
may change in case the clock source changes. Similarly,
CLOCK_MONOTONIC uses the WATCHDOG_RELATIVE threadq that will
only wakeup the thread after the requested count of ticks elapse.

updates #2732

comment:2 Changed on 07/26/16 at 18:17:57 by Gedare Bloom <gedare@…>

In 39d97ab78cfcc37eb8b1e7d9f9717f51b249155b/rtems:

cpukit: refactor nanosleep and use 64-bit timeout for threadq

  • Fixes a bug with elapsed time calculations misusing absolute time arguments in nanosleep_helper by passing the requested relative interval.
  • Fixes a bug with truncation of absolute timeouts by passing the full 64-bit value to Thread_queue_Enqueue.
  • Share yield logic between nanosleep and clock_nanosleep.

updates #2732

comment:3 Changed on 07/29/16 at 17:14:45 by Gedare Bloom <gedare@…>

In 842005e432136953d670e39cedc2d665ea949e7b/rtems:

posix: nanosleep: optimize away a time conversion

updates #2732

comment:4 Changed on 08/10/16 at 16:10:21 by Gedare Bloom <gedare@…>

In 709594f0fb29d4f860b99cda264ea3e74c635a72/rtems:

posix: nanosleep: adjust elapsed time calculation

Use clock_gettime before and after sleep to calculate
the time spent asleep, and the amount of time remaining.

updates #2732

comment:5 Changed on 05/11/17 at 07:31:02 by Sebastian Huber


comment:6 Changed on 06/30/17 at 13:27:37 by Gedare Bloom

Resolution: fixed
Status: newclosed

comment:7 Changed on 10/16/17 at 06:17:09 by Sebastian Huber

Component: scoreposix

comment:8 Changed on 11/09/17 at 06:27:14 by Sebastian Huber


Milestone renamed

Note: See TracTickets for help on using tickets.