summaryrefslogtreecommitdiff
path: root/src/ipcpd
diff options
context:
space:
mode:
authordimitri staessens <dimitri.staessens@ugent.be>2017-08-16 10:19:30 +0000
committerSander Vrijders <sander.vrijders@ugent.be>2017-08-16 10:19:30 +0000
commit44327027e32f5853995984a5bad9869b443898ca (patch)
tree0ac36f828e5bafc09f2b2d72dbadd3608e7d239e /src/ipcpd
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')
-rw-r--r--src/ipcpd/ipcp.c12
-rw-r--r--src/ipcpd/ipcp.h1
2 files changed, 11 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);
diff --git a/src/ipcpd/ipcp.h b/src/ipcpd/ipcp.h
index d2ad7cde..422670d7 100644
--- a/src/ipcpd/ipcp.h
+++ b/src/ipcpd/ipcp.h
@@ -93,6 +93,7 @@ struct ipcp {
uint8_t cbuf[IPCP_MSG_BUF_SIZE];
size_t cmd_len;
int csockfd;
+ pthread_cond_t acc_cond;
pthread_cond_t cmd_cond;
pthread_mutex_t cmd_lock;