|
|
|
|
@ -1341,6 +1341,9 @@ static struct iax2_thread *find_idle_thread(void)
|
|
|
|
|
if (ast_pthread_create_background(&thread->threadid, NULL, iax2_process_thread, thread)) {
|
|
|
|
|
ast_cond_destroy(&thread->cond);
|
|
|
|
|
ast_mutex_destroy(&thread->lock);
|
|
|
|
|
ast_mutex_unlock(&thread->init_lock);
|
|
|
|
|
ast_cond_destroy(&thread->init_cond);
|
|
|
|
|
ast_mutex_destroy(&thread->init_lock);
|
|
|
|
|
ast_free(thread);
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
@ -11757,10 +11760,17 @@ static int start_network_thread(void)
|
|
|
|
|
thread->threadnum = ++threadcount;
|
|
|
|
|
ast_mutex_init(&thread->lock);
|
|
|
|
|
ast_cond_init(&thread->cond, NULL);
|
|
|
|
|
ast_mutex_init(&thread->init_lock);
|
|
|
|
|
ast_cond_init(&thread->init_cond, NULL);
|
|
|
|
|
if (ast_pthread_create_background(&thread->threadid, NULL, iax2_process_thread, thread)) {
|
|
|
|
|
ast_log(LOG_WARNING, "Failed to create new thread!\n");
|
|
|
|
|
ast_mutex_destroy(&thread->lock);
|
|
|
|
|
ast_cond_destroy(&thread->cond);
|
|
|
|
|
ast_mutex_destroy(&thread->init_lock);
|
|
|
|
|
ast_cond_destroy(&thread->init_cond);
|
|
|
|
|
ast_free(thread);
|
|
|
|
|
thread = NULL;
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
AST_LIST_LOCK(&idle_list);
|
|
|
|
|
AST_LIST_INSERT_TAIL(&idle_list, thread, list);
|
|
|
|
|
|