aboutsummaryrefslogtreecommitdiffstats
path: root/main/cdr.c
diff options
context:
space:
mode:
authorrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2007-05-24 18:30:19 +0000
committerrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2007-05-24 18:30:19 +0000
commita42bc96f14e6c4c6c8fe8e7c743df555036e885b (patch)
tree86895556d8f221a39105f4398a54d612fbbd3da8 /main/cdr.c
parentf97bf5fd4d30bd179aac274961e7695ddc60e165 (diff)
Add a new API call for creating detached threads. Then, go replace all of the
places in the code where the same block of code for creating detached threads was replicated. (patch from bbryant) git-svn-id: http://svn.digium.com/svn/asterisk/trunk@65968 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main/cdr.c')
-rw-r--r--main/cdr.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/main/cdr.c b/main/cdr.c
index 5886aab07..fb1ce177e 100644
--- a/main/cdr.c
+++ b/main/cdr.c
@@ -1033,7 +1033,6 @@ static void *do_batch_backend_process(void *data)
void ast_cdr_submit_batch(int shutdown)
{
struct ast_cdr_batch_item *oldbatchitems = NULL;
- pthread_attr_t attr;
pthread_t batch_post_thread = AST_PTHREADT_NULL;
/* if there's no batch, or no CDRs in the batch, then there's nothing to do */
@@ -1053,16 +1052,13 @@ void ast_cdr_submit_batch(int shutdown)
ast_log(LOG_DEBUG, "CDR single-threaded batch processing begins now\n");
do_batch_backend_process(oldbatchitems);
} else {
- pthread_attr_init(&attr);
- pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
- if (ast_pthread_create_background(&batch_post_thread, &attr, do_batch_backend_process, oldbatchitems)) {
+ if (ast_pthread_create_detached_background(&batch_post_thread, NULL, do_batch_backend_process, oldbatchitems)) {
ast_log(LOG_WARNING, "CDR processing thread could not detach, now trying in this thread\n");
do_batch_backend_process(oldbatchitems);
} else {
if (option_debug)
ast_log(LOG_DEBUG, "CDR multi-threaded batch processing begins now\n");
}
- pthread_attr_destroy(&attr);
}
}