From 5432e665fd6eac776c5985d98058e5c4645ec0e4 Mon Sep 17 00:00:00 2001 From: Sander Vrijders Date: Thu, 11 Aug 2016 17:39:39 +0200 Subject: ipcpd: Add condition variable to IPCP state This adds a condition variable to the IPCP state, so that upon state changes any listeners to state changes can be notified. It also replaces the read/write lock with a mutex in order to be able to do so. --- src/ipcpd/ipcp.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/ipcpd/ipcp.h') diff --git a/src/ipcpd/ipcp.h b/src/ipcpd/ipcp.h index 630f7922..8b7d4ec9 100644 --- a/src/ipcpd/ipcp.h +++ b/src/ipcpd/ipcp.h @@ -45,10 +45,13 @@ struct ipcp { int irmd_fd; enum ipcp_state state; - pthread_rwlock_t state_lock; + pthread_mutex_t state_lock; + pthread_cond_t state_cond; }; struct ipcp * ipcp_instance_create(); +void ipcp_state_change(struct ipcp * ipcp, + enum ipcp_state state); void * ipcp_main_loop(void * o); void * ipcp_sdu_loop(void * o); int ipcp_parse_arg(int argc, char * argv[]); -- cgit v1.2.3