diff options
author | Jan Vesely <jano.vesely@gmail.com> | 2015-10-03 19:19:13 -0500 |
---|---|---|
committer | Emil Velikov <emil.l.velikov@gmail.com> | 2015-10-08 14:05:57 +0100 |
commit | c8031a879a3f442a4ca43243914c797615110d9b (patch) | |
tree | 30a485ce60a9502f91eeeed3f7d9e09a3bec4808 /include | |
parent | 89ae41ab4c9e32db9cbef0cb01a99c8e3efbb289 (diff) |
c11/threads: initialize timeout structure
Signed-off-by: Jan Vesely <jano.vesely@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/c11/threads_posix.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/include/c11/threads_posix.h b/include/c11/threads_posix.h index 3def6c41ca5..ce9853b18b3 100644 --- a/include/c11/threads_posix.h +++ b/include/c11/threads_posix.h @@ -136,8 +136,14 @@ cnd_timedwait(cnd_t *cond, mtx_t *mtx, const xtime *xt) { struct timespec abs_time; int rt; + assert(mtx != NULL); assert(cond != NULL); + assert(xt != NULL); + + abs_time.tv_sec = xt->sec; + abs_time.tv_nsec = xt->nsec; + rt = pthread_cond_timedwait(cond, mtx, &abs_time); if (rt == ETIMEDOUT) return thrd_busy; |