summaryrefslogtreecommitdiff
path: root/src/ipcpd/unicast
diff options
context:
space:
mode:
Diffstat (limited to 'src/ipcpd/unicast')
-rw-r--r--src/ipcpd/unicast/pol/link_state.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/ipcpd/unicast/pol/link_state.c b/src/ipcpd/unicast/pol/link_state.c
index 5360f556..d9482876 100644
--- a/src/ipcpd/unicast/pol/link_state.c
+++ b/src/ipcpd/unicast/pol/link_state.c
@@ -646,7 +646,7 @@ static void * lsupdate(void * o)
while (true) {
clock_gettime(CLOCK_REALTIME_COARSE, &now);
- pthread_rwlock_rdlock(&ls.db_lock);
+ pthread_rwlock_wrlock(&ls.db_lock);
pthread_cleanup_push((void (*) (void *)) pthread_rwlock_unlock,
(void *) &ls.db_lock);
@@ -1015,13 +1015,14 @@ void link_state_fini(void)
rib_unreg(LSDB);
- pthread_cancel(ls.listener);
- pthread_join(ls.listener, NULL);
+ notifier_unreg(handle_event);
+ pthread_cancel(ls.listener);
pthread_cancel(ls.lsreader);
- pthread_join(ls.lsreader, NULL);
-
pthread_cancel(ls.lsupdate);
+
+ pthread_join(ls.listener, NULL);
+ pthread_join(ls.lsreader, NULL);
pthread_join(ls.lsupdate, NULL);
fset_destroy(ls.mgmt_set);
@@ -1043,6 +1044,4 @@ void link_state_fini(void)
pthread_rwlock_destroy(&ls.db_lock);
pthread_mutex_destroy(&ls.routing_i_lock);
-
- notifier_unreg(handle_event);
}