summaryrefslogtreecommitdiff
path: root/src/ipcpd/ipcp.c
diff options
context:
space:
mode:
authordimitri staessens <[email protected]>2017-08-16 10:19:30 +0000
committerSander Vrijders <[email protected]>2017-08-16 10:19:30 +0000
commit44327027e32f5853995984a5bad9869b443898ca (patch)
tree0ac36f828e5bafc09f2b2d72dbadd3608e7d239e /src/ipcpd/ipcp.c
parentc8283ea410e7d640537303c6b644bbc3afb35cd5 (diff)
parent6b33850f488ddd23fa29952a8c5d2a7c544617d3 (diff)
downloadouroboros-44327027e32f5853995984a5bad9869b443898ca.tar.gz
ouroboros-44327027e32f5853995984a5bad9869b443898ca.zip
Merged in dstaesse/ouroboros/be-accept-target (pull request #554)
irmd, ipcpd: Signal acceptor only
Diffstat (limited to 'src/ipcpd/ipcp.c')
-rw-r--r--src/ipcpd/ipcp.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/ipcpd/ipcp.c b/src/ipcpd/ipcp.c
index c5769f9e..7066fb04 100644
--- a/src/ipcpd/ipcp.c
+++ b/src/ipcpd/ipcp.c
@@ -138,7 +138,7 @@ static void * acceptloop(void * o)
pthread_cond_signal(&ipcpi.cmd_cond);
while (ipcpi.csockfd != -1)
- pthread_cond_wait(&ipcpi.cmd_cond, &ipcpi.cmd_lock);
+ pthread_cond_wait(&ipcpi.acc_cond, &ipcpi.cmd_lock);
pthread_mutex_unlock(&ipcpi.cmd_lock);
}
@@ -189,7 +189,7 @@ static void * mainloop(void * o)
continue;
}
- pthread_cond_broadcast(&ipcpi.cmd_cond);
+ pthread_cond_signal(&ipcpi.acc_cond);
msg = ipcp_msg__unpack(NULL, ipcpi.cmd_len, ipcpi.cbuf);
if (msg == NULL) {
@@ -591,6 +591,11 @@ int ipcp_init(int argc,
goto fail_cmd_cond;
}
+ if (pthread_cond_init(&ipcpi.acc_cond, &cattr)) {
+ log_err("Failed to init convar.");
+ goto fail_acc_cond;
+ }
+
ipcpi.alloc_id = -1;
ipcpi.csockfd = -1;
@@ -607,6 +612,8 @@ int ipcp_init(int argc,
return 0;
fail_shim_data:
+ pthread_cond_destroy(&ipcpi.acc_cond);
+ fail_acc_cond:
pthread_cond_destroy(&ipcpi.cmd_cond);
fail_cmd_cond:
pthread_mutex_destroy(&ipcpi.cmd_lock);
@@ -702,6 +709,7 @@ void ipcp_fini()
pthread_mutex_destroy(&ipcpi.state_mtx);
pthread_cond_destroy(&ipcpi.alloc_cond);
pthread_mutex_destroy(&ipcpi.alloc_lock);
+ pthread_cond_destroy(&ipcpi.acc_cond);
pthread_cond_destroy(&ipcpi.cmd_cond);
pthread_mutex_destroy(&ipcpi.cmd_lock);