Merged revisions 49636 via svnmerge from

https://origsvn.digium.com/svn/asterisk/branches/1.4

................
r49636 | kpfleming | 2007-01-05 11:09:00 -0600 (Fri, 05 Jan 2007) | 10 lines

Merged revisions 49635 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.2

........
r49635 | kpfleming | 2007-01-05 10:56:40 -0600 (Fri, 05 Jan 2007) | 2 lines

ensure that threads which are supposed to be detached (because we aren't going to wait on them) are created properly

........

................


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@49637 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Kevin P. Fleming
2007-01-05 17:10:59 +00:00
parent 2288b11bf4
commit a8dc50812f
3 changed files with 19 additions and 12 deletions

View File

@@ -749,7 +749,6 @@ static struct in_addr __ourip;
struct ast_hostent ahp;
struct hostent *hp;
static int skinnysock = -1;
static pthread_t tcp_thread;
static pthread_t accept_t;
static char context[AST_MAX_CONTEXT] = "default";
static char language[MAX_LANGUAGE] = "";
@@ -4271,6 +4270,7 @@ static void *accept_thread(void *ignore)
struct protoent *p;
int arg = 1;
pthread_attr_t attr;
pthread_t tcp_thread;
pthread_attr_init(&attr);
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
@@ -4299,7 +4299,7 @@ static void *accept_thread(void *ignore)
sessions = s;
ast_mutex_unlock(&sessionlock);
if (ast_pthread_create(&tcp_thread, NULL, skinny_session, s)) {
if (ast_pthread_create(&tcp_thread, &attr, skinny_session, s)) {
destroy_session(s);
}
}
@@ -4678,13 +4678,6 @@ static int unload_module(void)
monitor_thread = AST_PTHREADT_STOP;
ast_mutex_unlock(&monlock);
if (tcp_thread && (tcp_thread != AST_PTHREADT_STOP)) {
pthread_cancel(tcp_thread);
pthread_kill(tcp_thread, SIGURG);
pthread_join(tcp_thread, NULL);
}
tcp_thread = AST_PTHREADT_STOP;
ast_mutex_lock(&netlock);
if (accept_t && (accept_t != AST_PTHREADT_STOP)) {
pthread_cancel(accept_t);