c11/threads: initialize timeout structure
authorJan Vesely <jano.vesely@gmail.com>
Sun, 4 Oct 2015 00:19:13 +0000 (19:19 -0500)
committerEmil Velikov <emil.l.velikov@gmail.com>
Thu, 8 Oct 2015 13:05:57 +0000 (14:05 +0100)
Signed-off-by: Jan Vesely <jano.vesely@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
include/c11/threads_posix.h

index 3def6c41ca57c94189332eb4773cbb6141577d1c..ce9853b18b3b1f969e6e2aafcaafb3401d70ac29 100644 (file)
@@ -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;