mirror of
https://github.com/cloudwu/skynet.git
synced 2026-07-24 20:23:06 +00:00
lock before set quit flag
This commit is contained in:
@@ -112,9 +112,10 @@ thread_timer(void *p) {
|
|||||||
// wakeup socket thread
|
// wakeup socket thread
|
||||||
skynet_socket_exit();
|
skynet_socket_exit();
|
||||||
// wakeup all worker thread
|
// 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;
|
m->quit = 1;
|
||||||
pthread_cond_broadcast(&m->cond);
|
pthread_cond_broadcast(&m->cond);
|
||||||
|
pthread_mutex_unlock(&m->mutex);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user