[asterisk-commits] dhubbard: branch dhubbard/named_processors r110607 - /team/dhubbard/named_pro...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Mar 21 22:21:33 CDT 2008


Author: dhubbard
Date: Fri Mar 21 22:21:32 2008
New Revision: 110607

URL: http://svn.digium.com/view/asterisk?view=rev&rev=110607
Log:
minor changes

Modified:
    team/dhubbard/named_processors/main/taskprocessor.c

Modified: team/dhubbard/named_processors/main/taskprocessor.c
URL: http://svn.digium.com/view/asterisk/team/dhubbard/named_processors/main/taskprocessor.c?view=diff&rev=110607&r1=110606&r2=110607
==============================================================================
--- team/dhubbard/named_processors/main/taskprocessor.c (original)
+++ team/dhubbard/named_processors/main/taskprocessor.c Fri Mar 21 22:21:32 2008
@@ -41,12 +41,12 @@
 AST_LIST_HEAD_STATIC(_taskprocessor_singletons, taskprocessor_singleton_info);
 static int _taskprocessor_singletons_list_size = 0;
 
-static void* default_taskprocessor_thread_function(void* data);
+static void* tps_default_processor_function(void* data);
 static struct taskprocessor_singleton_info* tps_default_constructor(int poll_freq);
 static int tps_taskprocessor_add(struct taskprocessor_singleton_info* t);
 static void tps_taskprocessor_destroy(void *tps);
-static void destroy_taskproducer(void *tp);
-static int taskprocessor_ping(struct a_task* e);
+static void tps_taskproducer_destroy(void *tp);
+static int tps_taskprocessor_ping_handler(struct a_task* e);
 
 static char *cli_taskprocessor_ping(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a);
 static char *cli_taskprocessor_show_stats(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a);
@@ -164,7 +164,7 @@
 		return CLI_SUCCESS;
 	}
 
-	t = ast_task_alloc(taskprocessor_ping, 0, "cli_taskprocessor_ping");
+	t = ast_task_alloc(tps_taskprocessor_ping_handler, 0, "cli_taskprocessor_ping");
 	if (ast_taskprocessor_push(p, t) < 0) {
 		ast_cli(a->fd, "\n%s failed: could not push task to %s\n", e->command, a->argv[2]);
 		ast_task_free(t);
@@ -221,7 +221,7 @@
  * \note The default taskprocessor thread function can be overridden via ast_taskprocessor_reference()
  * \return NULL
  */
-static void* default_taskprocessor_thread_function(void* data)
+static void* tps_default_processor_function(void* data)
 {
 	struct taskprocessor_singleton_info* i;
 	struct a_task* t;
@@ -294,7 +294,7 @@
  * \param task the ping task queued by the CLI operation
  * \return 0 on success, -1 on error
  */
-static int taskprocessor_ping(struct a_task* task)
+static int tps_taskprocessor_ping_handler(struct a_task* task)
 {
 	if (!task) {
 		ast_log(LOG_ERROR, "Huh?  There is no task?  This is totally unexpected!\n");
@@ -391,7 +391,7 @@
 		if (custom_func) {
 			rc = ast_pthread_create(&p->_poll_thread, &_attribute[index], custom_func, p);
 		} else {
-			rc = ast_pthread_create(&p->_poll_thread, &_attribute[index], default_taskprocessor_thread_function, p);
+			rc = ast_pthread_create(&p->_poll_thread, &_attribute[index], tps_default_processor_function, p);
 		}
 		if (rc < 0) {
 			ast_mutex_unlock(&p->_taskprocessor_lock);
@@ -453,7 +453,7 @@
 	AST_LIST_LOCK(&_taskprocessor_singletons);
 	AST_LIST_TRAVERSE(&_taskprocessor_singletons, n, list) {
 		if (!strcasecmp(n->_name, t->_name)) {
-			ast_log(LOG_WARNING, "cannot add taskprocessor singleton \'%s\' because it already exists with ID: 0x%X\n", t->_name, (unsigned int)t->_id);
+			ast_log(LOG_WARNING, "A taskprocessor named \'%s\' already exists\n", t->_name);
 			AST_LIST_UNLOCK(&_taskprocessor_singletons);
 			return -1;
 		}
@@ -514,7 +514,7 @@
  */
 struct a_task* ast_taskprocessor_pop(struct taskprocessor_singleton_info* tps)
 {
-	struct a_task* t=NULL;
+	struct a_task* t = NULL;
 	int lock_failures = 0;
 
 	AST_LIST_LOCK(&tps->_queue);
@@ -570,10 +570,9 @@
 static int tps_default_queue_task(struct taskproducer* producer, struct a_task* task)
 {
 	if (!((producer)&&(producer->_taskprocessor)) || !task) {
-		ast_log(LOG_ERROR, "this function requires a \'%s\' structure too.\n", (task)?"producer":"task");
+		ast_log(LOG_ERROR, "this function requires a proper \'%s\' structure.\n", (task)?"producer":"task");
 		return -1;
 	}
-	ast_log(LOG_DEBUG, "task from \'%s\' queued to taskprocessor \'%s\'\n", task->_source, producer->_taskprocessor->_name);
 	if (ast_taskprocessor_push(producer->_taskprocessor, task) < 0) {
 		ast_log(LOG_ERROR, "we failed to push task to taskprocessor \'%s\'.\n", producer->_taskprocessor->_name);
 		return -1;
@@ -592,7 +591,7 @@
 struct taskproducer* ast_taskproducer_alloc(struct taskprocessor_singleton_info* processor)
 {
 	struct taskproducer* p;
-	p = ao2_alloc(sizeof(*p), destroy_taskproducer);
+	p = ao2_alloc(sizeof(*p), tps_taskproducer_destroy);
 	if (!p) {
 		ast_log(LOG_ERROR, "cannot allocate memory for a taskproducer structure.\n");
 		return NULL;
@@ -600,7 +599,6 @@
 	p->_taskprocessor = processor;
 	ao2_ref(processor, 1);
 	p->queue_task = tps_default_queue_task;
-	ast_log(LOG_DEBUG, "taskproducer created\n");
 	return p;
 }
 
@@ -608,11 +606,10 @@
  * \param tp taskproducer
  * \return void
  */
-static void destroy_taskproducer(void *tp)
+static void tps_taskproducer_destroy(void *tp)
 {
 	struct taskproducer *p;
 	p = (struct taskproducer *)tp;
-	ast_log(LOG_DEBUG, "destroying taskproducer\n");
 	ao2_ref(p->_taskprocessor, -1);
 }
 




More information about the asterisk-commits mailing list