lock before set quit flag

This commit is contained in:
Cloud Wu
2015-06-09 21:46:37 +08:00
parent 57d43a588e
commit 039235b3a3

View File

@@ -112,9 +112,10 @@ thread_timer(void *p) {
// wakeup socket thread
skynet_socket_exit();
// wakeup all worker thread
// we don't need lock m before set m->quit, because it can only set once.
pthread_mutex_lock(&m->mutex);
m->quit = 1;
pthread_cond_broadcast(&m->cond);
pthread_mutex_unlock(&m->mutex);
return NULL;
}