summaryrefslogtreecommitdiffstats
path: root/lib/libc_r/uthread/uthread_nanosleep.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libc_r/uthread/uthread_nanosleep.c')
-rw-r--r--lib/libc_r/uthread/uthread_nanosleep.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/libc_r/uthread/uthread_nanosleep.c b/lib/libc_r/uthread/uthread_nanosleep.c
index 39c7dad..4ec7d3f 100644
--- a/lib/libc_r/uthread/uthread_nanosleep.c
+++ b/lib/libc_r/uthread/uthread_nanosleep.c
@@ -66,6 +66,7 @@ nanosleep(const struct timespec * time_to_sleep,
_thread_run->wakeup_time.tv_sec += 1;
_thread_run->wakeup_time.tv_nsec -= 1000000000;
}
+ _thread_run->interrupted = 0;
/* Reschedule the current thread to sleep: */
_thread_kern_sched_state(PS_SLEEP_WAIT, __FILE__, __LINE__);
@@ -106,8 +107,8 @@ nanosleep(const struct timespec * time_to_sleep,
time_remaining->tv_nsec = remaining_time.tv_nsec;
}
- /* Check if the entire sleep was not completed: */
- if (remaining_time.tv_nsec != 0 || remaining_time.tv_sec != 0) {
+ /* Check if the sleep was interrupted: */
+ if (_thread_run->interrupted) {
/* Return an EINTR error : */
errno = EINTR;
ret = -1;
OpenPOWER on IntegriCloud