aboutsummaryrefslogtreecommitdiffstats
path: root/executor
diff options
context:
space:
mode:
Diffstat (limited to 'executor')
-rw-r--r--executor/executor_posix.h11
1 files changed, 9 insertions, 2 deletions
diff --git a/executor/executor_posix.h b/executor/executor_posix.h
index e9b06b807..e75bfb3a7 100644
--- a/executor/executor_posix.h
+++ b/executor/executor_posix.h
@@ -23,10 +23,17 @@ struct event_t {
void event_init(event_t* ev)
{
- if (pthread_mutex_init(&ev->mu, 0))
+ // Akaros crashes on NULL attr.
+ pthread_mutexattr_t attr;
+ pthread_mutexattr_init(&attr);
+ if (pthread_mutex_init(&ev->mu, &attr))
fail("pthread_mutex_init failed");
- if (pthread_cond_init(&ev->cv, 0))
+ pthread_mutexattr_destroy(&attr);
+ pthread_condattr_t cvattr;
+ pthread_condattr_init(&cvattr);
+ if (pthread_cond_init(&ev->cv, &cvattr))
fail("pthread_cond_init failed");
+ pthread_condattr_destroy(&cvattr);
ev->state = false;
}