summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/ipcpd/unicast/fa.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/ipcpd/unicast/fa.c b/src/ipcpd/unicast/fa.c
index e0727e85..e154d785 100644
--- a/src/ipcpd/unicast/fa.c
+++ b/src/ipcpd/unicast/fa.c
@@ -274,7 +274,8 @@ static void * fa_handle_packet(void * o)
int fa_init(void)
{
- int i;
+ pthread_condattr_t cattr;
+ int i;
for (i = 0; i < PROG_MAX_FLOWS; ++i)
destroy_conn(i);
@@ -285,9 +286,17 @@ int fa_init(void)
if (pthread_mutex_init(&fa.mtx, NULL))
goto fail_mtx;
- if (pthread_cond_init(&fa.cond, NULL))
+ if (pthread_condattr_init(&cattr))
+ goto fail_cattr;
+
+#ifndef __APPLE__
+ pthread_condattr_setclock(&cattr, PTHREAD_COND_CLOCK);
+#endif
+ if (pthread_cond_init(&fa.cond, &cattr))
goto fail_cond;
+ pthread_condattr_destroy(&cattr);
+
list_head_init(&fa.cmds);
fa.fd = dt_reg_comp(&fa, &fa_post_packet, FA);
@@ -295,6 +304,8 @@ int fa_init(void)
return 0;
fail_cond:
+ pthread_condattr_destroy(&cattr);
+ fail_cattr:
pthread_mutex_destroy(&fa.mtx);
fail_mtx:
pthread_rwlock_destroy(&fa.flows_lock);