[asterisk-commits] dlee: branch dlee/performance r399648 - /team/dlee/performance/main/
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Mon Sep 23 16:55:42 CDT 2013
Author: dlee
Date: Mon Sep 23 16:55:39 2013
New Revision: 399648
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=399648
Log:
Keep trying
Modified:
team/dlee/performance/main/taskprocessor.c
Modified: team/dlee/performance/main/taskprocessor.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/performance/main/taskprocessor.c?view=diff&rev=399648&r1=399647&r2=399648
==============================================================================
--- team/dlee/performance/main/taskprocessor.c (original)
+++ team/dlee/performance/main/taskprocessor.c Mon Sep 23 16:55:39 2013
@@ -114,7 +114,7 @@
static int tps_cmp_cb(void *obj, void *arg, int flags);
/*! \brief The task processing function executed by a taskprocessor */
-static void *default_tps_processing_function(void *data);
+static void *tps_processing_function(void *data);
/*! \brief Destroy the taskprocessor when its refcount reaches zero */
static void tps_taskprocessor_destroy(void *tps);
@@ -144,7 +144,6 @@
int dead;
};
-static void default_listener_pvt_destroy(struct default_taskprocessor_listener_pvt *pvt);
static void default_tps_wake_up(struct default_taskprocessor_listener_pvt *pvt, int should_die)
{
@@ -168,7 +167,7 @@
* \brief Function that processes tasks in the taskprocessor
* \internal
*/
-static void *default_tps_processing_function(void *data)
+static void *tps_processing_function(void *data)
{
struct ast_taskprocessor_listener *listener = data;
struct ast_taskprocessor *tps = listener->tps;
@@ -180,19 +179,6 @@
dead = default_tps_idle(pvt);
}
}
-
- /* Drain the rest of the queue */
- while (ast_taskprocessor_execute(tps)) {
- /* No-op */
- }
-
- /* Destroy the private data section */
- default_listener_pvt_destroy(pvt);
- listener->user_data = NULL;
-
- /* Get rid of the shutdown ref */
- ao2_ref(tps, -1);
-
return NULL;
}
@@ -200,7 +186,7 @@
{
struct default_taskprocessor_listener_pvt *pvt = listener->user_data;
- if (ast_pthread_create(&pvt->poll_thread, NULL, default_tps_processing_function, listener)) {
+ if (ast_pthread_create(&pvt->poll_thread, NULL, tps_processing_function, listener)) {
return -1;
}
@@ -228,17 +214,10 @@
static void default_listener_shutdown(struct ast_taskprocessor_listener *listener)
{
struct default_taskprocessor_listener_pvt *pvt = listener->user_data;
-
- /* Keep tps around long enough for the thread to exit */
- ao2_ref(listener->tps, +1);
default_tps_wake_up(pvt, 1);
- if (pthread_self() == pvt->poll_thread) {
- /* Shutting self down. Yay! */
- pthread_detach(pvt->poll_thread);
- } else {
- pthread_join(pvt->poll_thread, NULL);
- }
+ pthread_join(pvt->poll_thread, NULL);
pvt->poll_thread = AST_PTHREADT_NULL;
+ default_listener_pvt_destroy(pvt);
}
static const struct ast_taskprocessor_listener_callbacks default_listener_callbacks = {
More information about the asterisk-commits
mailing list