Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
tcp_server_done: improve shutdown locking (clang sanitizer)
  • Loading branch information
perexg committed Mar 10, 2016
1 parent 1222481 commit 78507af
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/tcp.c
Expand Up @@ -1115,14 +1115,15 @@ tcp_server_done(void)
tvh_pipe_close(&tcp_server_pipe);
tvhpoll_destroy(tcp_server_poll);

pthread_mutex_lock(&global_lock);
t = mclk();
while (LIST_FIRST(&tcp_server_active) != NULL) {
if (t + sec2mono(5) < mclk())
tvhtrace("tcp", "tcp server %p active too long", LIST_FIRST(&tcp_server_active));
pthread_mutex_unlock(&global_lock);
tvh_safe_usleep(20000);
pthread_mutex_lock(&global_lock);
}

pthread_mutex_lock(&global_lock);
while ((tsl = LIST_FIRST(&tcp_server_join)) != NULL) {
LIST_REMOVE(tsl, jlink);
pthread_mutex_unlock(&global_lock);
Expand Down

0 comments on commit 78507af

Please sign in to comment.