fix deadlock in wait_while_interface_down

This commit is contained in:
Bill Williams
2019-11-14 10:56:47 -08:00
parent 17c7faff50
commit bfad8ed44b

View File

@@ -641,18 +641,17 @@ int wait_while_interface_down()
close_and_unref_connection (get_global_conn());
set_global_conn(NULL);
pthread_mutex_lock(get_interface_down_mut());
while (!get_interface_down_event ()) {
pthread_mutex_lock(get_interface_down_mut());
rtn = pthread_cond_wait(get_interface_down_con(), get_interface_down_mut());
pthread_mutex_unlock (get_interface_down_mut());
if (rtn != 0)
ParodusError
("Error on pthread_cond_wait (%d) in wait_while_interface_down\n", rtn);
if ((rtn != 0) || g_shutdown) {
pthread_mutex_unlock (get_interface_down_mut());
return -1;
}
}
pthread_mutex_unlock (get_interface_down_mut());
return 0;
}