mirror of
https://github.com/3proxy/3proxy.git
synced 2025-02-24 02:55:40 +08:00
Prevent deadlock on thread creation error
This commit is contained in:
parent
e0262c23b0
commit
46211c26d2
@ -643,6 +643,7 @@ int MODULEMAINFUNC (int argc, char** argv){
|
||||
}
|
||||
#endif
|
||||
newparam->prev = newparam->next = NULL;
|
||||
error = 0;
|
||||
pthread_mutex_lock(&srv.counter_mutex);
|
||||
if(!srv.child){
|
||||
srv.child = newparam;
|
||||
@ -665,7 +666,7 @@ int MODULEMAINFUNC (int argc, char** argv){
|
||||
else {
|
||||
sprintf((char *)buf, "_beginthreadex(): %s", _strerror(NULL));
|
||||
if(!srv.silent)(*srv.logfunc)(&defparam, buf);
|
||||
freeparam(newparam);
|
||||
error = 1;
|
||||
}
|
||||
#else
|
||||
|
||||
@ -674,13 +675,14 @@ int MODULEMAINFUNC (int argc, char** argv){
|
||||
if(error){
|
||||
sprintf((char *)buf, "pthread_create(): %s", strerror(error));
|
||||
if(!srv.silent)(*srv.logfunc)(&defparam, buf);
|
||||
freeparam(newparam);
|
||||
}
|
||||
else {
|
||||
newparam->threadid = (unsigned)thread;
|
||||
}
|
||||
#endif
|
||||
pthread_mutex_unlock(&srv.counter_mutex);
|
||||
if(error) freeparam(newparam);
|
||||
|
||||
memset(&defparam.sincl, 0, sizeof(defparam.sincl));
|
||||
memset(&defparam.sincr, 0, sizeof(defparam.sincr));
|
||||
if(isudp) while(!srv.fds.events)usleep(SLEEPTIME);
|
||||
|
Loading…
Reference in New Issue
Block a user