1
0
mirror of https://github.com/coturn/coturn.git synced 2025-10-23 12:00:59 +02:00

Fix: race auth_server thread create & detach

This commit is contained in:
shuyin.wsy 2018-09-05 09:47:35 +08:00 committed by Mészáros Mihály
parent b96c4d67a3
commit 0964392b9f
2 changed files with 5 additions and 2 deletions

View File

@ -22,6 +22,7 @@ Version 4.5.0.8 'dan Eider':
- Add more explanation on use-auth-secret / REST in example config (by Krithin Sitaram)
- Add a Warning if lines in config file ends with semicolon (by heyheyjc)
- Fix --prod pointer bug
- Fix auth server thread detach race (by weishuyin)
12/10/2017 Oleg Moskalenko <mom040267@gmail.com>
Version 4.5.0.7 'dan Eider':

View File

@ -1786,11 +1786,13 @@ static void* run_auth_server_thread(void *arg)
static void setup_auth_server(struct auth_server *as)
{
if(pthread_create(&(as->thr), NULL, run_auth_server_thread, as)) {
pthread_attr_t attr;
if(pthread_attr_init(&attr) ||
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED) ||
pthread_create(&(as->thr), &attr, run_auth_server_thread, as)) {
perror("Cannot create auth thread\n");
exit(-1);
}
pthread_detach(as->thr);
}
static void* run_admin_server_thread(void *arg)