[asterisk-commits] rmudgett: trunk r402045 - in /trunk: ./ main/taskprocessor.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Fri Oct 25 18:58:34 CDT 2013
Author: rmudgett
Date: Fri Oct 25 18:58:32 2013
New Revision: 402045
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=402045
Log:
taskprocessor: Made use pthread_equal() to compare thread ids.
* Removed another silly use of RAII_VAR(). RAII_VAR() and SCOPED_LOCK()
are not silver bullets that allow you to turn off your brain.
........
Merged revisions 402044 from http://svn.asterisk.org/svn/asterisk/branches/12
Modified:
trunk/ (props changed)
trunk/main/taskprocessor.c
Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-12-merged' - no diff available.
Modified: trunk/main/taskprocessor.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/taskprocessor.c?view=diff&rev=402045&r1=402044&r2=402045
==============================================================================
--- trunk/main/taskprocessor.c (original)
+++ trunk/main/taskprocessor.c Fri Oct 25 18:58:32 2013
@@ -232,17 +232,17 @@
ast_taskprocessor_push(listener->tps, default_listener_die, pvt);
- if (pthread_self() == pvt->poll_thread) {
+ ast_assert(pvt->poll_thread != AST_PTHREADT_NULL);
+
+ if (pthread_equal(pthread_self(), pvt->poll_thread)) {
res = pthread_detach(pvt->poll_thread);
if (res != 0) {
- ast_log(LOG_ERROR, "pthread_detach(): %s\n",
- strerror(errno));
+ ast_log(LOG_ERROR, "pthread_detach(): %s\n", strerror(errno));
}
} else {
res = pthread_join(pvt->poll_thread, NULL);
if (res != 0) {
- ast_log(LOG_ERROR, "pthread_join(): %s\n",
- strerror(errno));
+ ast_log(LOG_ERROR, "pthread_join(): %s\n", strerror(errno));
}
}
pvt->poll_thread = AST_PTHREADT_NULL;
@@ -538,18 +538,15 @@
struct ast_taskprocessor_listener *ast_taskprocessor_listener_alloc(const struct ast_taskprocessor_listener_callbacks *callbacks, void *user_data)
{
- RAII_VAR(struct ast_taskprocessor_listener *, listener,
- NULL, ao2_cleanup);
+ struct ast_taskprocessor_listener *listener;
listener = ao2_alloc(sizeof(*listener), taskprocessor_listener_dtor);
-
if (!listener) {
return NULL;
}
listener->callbacks = callbacks;
listener->user_data = user_data;
- ao2_ref(listener, +1);
return listener;
}
More information about the asterisk-commits
mailing list