summaryrefslogtreecommitdiff
path: root/src/ipcpd/ipcp.c
diff options
context:
space:
mode:
authordimitri staessens <dimitri.staessens@intec.ugent.be>2016-08-12 11:55:52 +0200
committerdimitri staessens <dimitri.staessens@intec.ugent.be>2016-08-12 11:55:52 +0200
commit44cc6aaa41d88dc978a087178fd74a1c2dba70fd (patch)
tree10b398bf23356751a961c332a9dff053c6927f24 /src/ipcpd/ipcp.c
parentcf30e07cf862b117013e8c7fa2fb5c2ac8fef245 (diff)
parent5432e665fd6eac776c5985d98058e5c4645ec0e4 (diff)
downloadouroboros-44cc6aaa41d88dc978a087178fd74a1c2dba70fd.tar.gz
ouroboros-44cc6aaa41d88dc978a087178fd74a1c2dba70fd.zip
Merged in sandervrijders/ouroboros/be-state-mutex (pull request #209)
ipcpd: Add condition variable to IPCP state
Diffstat (limited to 'src/ipcpd/ipcp.c')
-rw-r--r--src/ipcpd/ipcp.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/ipcpd/ipcp.c b/src/ipcpd/ipcp.c
index 24f580e5..5c066cb0 100644
--- a/src/ipcpd/ipcp.c
+++ b/src/ipcpd/ipcp.c
@@ -42,11 +42,22 @@ struct ipcp * ipcp_instance_create()
i->irmd_fd = -1;
i->state = IPCP_INIT;
- pthread_rwlock_init(&i->state_lock, NULL);
+ pthread_mutex_init(&i->state_lock, NULL);
+ pthread_cond_init(&i->state_cond, NULL);
return i;
}
+void ipcp_state_change(struct ipcp * ipcp,
+ enum ipcp_state state)
+{
+ if (ipcp == NULL)
+ return;
+
+ ipcp->state = state;
+ pthread_cond_broadcast(&ipcp->state_cond);
+}
+
int ipcp_parse_arg(int argc, char * argv[])
{
char * log_file;