diff options
author | tilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2006-01-07 07:27:18 +0000 |
---|---|---|
committer | tilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2006-01-07 07:27:18 +0000 |
commit | a507c137779e16ff3d984442e75aa7a8271a6ef9 (patch) | |
tree | 01f60e7646d5fbcc8c0f87a1f1fa0a70afe8cdb3 | |
parent | adf658be6c6914d9bdf327463623ae3c5e8570fe (diff) |
Bug 6156 - catch all threading errors, not just simple failure
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.2@7848 f38db490-d61c-443f-a65b-d21fe96a405b
-rw-r--r-- | pbx/pbx_spool.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/pbx/pbx_spool.c b/pbx/pbx_spool.c index b9af5d81b..244f7b2f5 100644 --- a/pbx/pbx_spool.c +++ b/pbx/pbx_spool.c @@ -289,10 +289,11 @@ static void launch_service(struct outgoing *o) { pthread_t t; pthread_attr_t attr; + int ret; pthread_attr_init(&attr); pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); - if (ast_pthread_create(&t,&attr,attempt_thread, o) == -1) { - ast_log(LOG_WARNING, "Unable to create thread :(\n"); + if ((ret = ast_pthread_create(&t,&attr,attempt_thread, o)) != 0) { + ast_log(LOG_WARNING, "Unable to create thread :( (returned error: %d)\n", ret); free_outgoing(o); } } @@ -413,6 +414,7 @@ int load_module(void) { pthread_t thread; pthread_attr_t attr; + int ret; snprintf(qdir, sizeof(qdir), "%s/%s", ast_config_AST_SPOOL_DIR, "outgoing"); if (mkdir(qdir, 0700) && (errno != EEXIST)) { ast_log(LOG_WARNING, "Unable to create queue directory %s -- outgoing spool disabled\n", qdir); @@ -420,8 +422,8 @@ int load_module(void) } pthread_attr_init(&attr); pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); - if (ast_pthread_create(&thread,&attr,scan_thread, NULL) == -1) { - ast_log(LOG_WARNING, "Unable to create thread :(\n"); + if ((ret = ast_pthread_create(&thread,&attr,scan_thread, NULL)) != 0) { + ast_log(LOG_WARNING, "Unable to create thread :( (returned error: %d)\n", ret); return -1; } return 0; |