mirror of
https://github.com/cloudwu/skynet.git
synced 2026-07-24 03:53:09 +00:00
lock before set quit flag
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user