File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed
Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -945,18 +945,22 @@ nc_server_config_destroy_ch_client(struct nc_ch_client *ch_client)
945945 pthread_t tid ;
946946 uint16_t i , ch_endpt_count ;
947947
948+ /* CH COND LOCK */
949+ pthread_mutex_lock (& ch_client -> thread_data -> cond_lock );
948950 if (ch_client -> thread_data -> thread_running ) {
949- /* get tid */
950- tid = ch_client -> tid ;
951- /* CH COND LOCK */
952- pthread_mutex_lock (& ch_client -> thread_data -> cond_lock );
953951 ch_client -> thread_data -> thread_running = 0 ;
954952 pthread_cond_signal (& ch_client -> thread_data -> cond );
955953 /* CH COND UNLOCK */
956954 pthread_mutex_unlock (& ch_client -> thread_data -> cond_lock );
957955
956+ /* get tid */
957+ tid = ch_client -> tid ;
958+
958959 /* wait for the thread to terminate */
959960 pthread_join (tid , NULL );
961+ } else {
962+ /* CH COND UNLOCK */
963+ pthread_mutex_unlock (& ch_client -> thread_data -> cond_lock );
960964 }
961965
962966 /* free its members */
You can’t perform that action at this time.
0 commit comments