summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authordimitri staessens <dimitri.staessens@intec.ugent.be>2017-02-09 23:44:19 +0100
committerdimitri staessens <dimitri.staessens@intec.ugent.be>2017-02-09 23:45:50 +0100
commit4ab16c933f829f51d202c77cfb98f552ad887159 (patch)
tree6dd868eea3d699a67810f1e18365e902d6db228c /src/lib
parent773502eb6c8dd6fc1611a2140786e281d2af404a (diff)
downloadouroboros-4ab16c933f829f51d202c77cfb98f552ad887159.tar.gz
ouroboros-4ab16c933f829f51d202c77cfb98f552ad887159.zip
lib, ipcp: Correctly init condvars
The timerwheel and RIB use timedwaits. The condition variables are now correctly initialised to use the configuration defined clock.
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/rib.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/lib/rib.c b/src/lib/rib.c
index e0456b6f..c77eab20 100644
--- a/src/lib/rib.c
+++ b/src/lib/rib.c
@@ -778,11 +778,19 @@ static struct rib_sub * rib_get_sub(uint32_t sid)
static struct rib_sub * rib_sub_create(uint32_t sid)
{
+ pthread_condattr_t cattr;
struct rib_sub * sub = malloc(sizeof(*sub));
if (sub == NULL)
return NULL;
- if (pthread_cond_init(&sub->cond, NULL)) {
+ if (pthread_condattr_init(&cattr)) {
+ free(sub);
+ return NULL;
+ }
+#ifndef __APPLE__
+ pthread_condattr_setclock(&cattr, PTHREAD_COND_CLOCK);
+#endif
+ if (pthread_cond_init(&sub->cond, &cattr)) {
free(sub);
return NULL;
}