AT TOP LEVEL: //-- declare our thread variables static pthread_t worker_cdr_thread; AST_MUTEX_DEFINE_STATIC(worker_cdr_lock); ast_cond_t worker_cdr_cond; IN LOAD MODULE: //-- Create worker thread to post CDR records if (ast_pthread_create(&worker_cdr_thread, NULL, voctel_queue_worker, NULL)) { ast_log(LOG_ERROR, "VocTelCDR: Unable to create CDR worker thread\n"); return -1; } IN voctel_queue_worker: //-- ast_log(LOG_DEBUG, "VocTelCDR: Queue Worker thread has started\n"); Try using this stuff: pthread_attr_t attr; pthread_attr_init(&attr); pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); ast_pthread_create(thread, &attr, function, data);