[asterisk-dev] Pthread wrapper updates

Kevin P. Fleming kpfleming at digium.com
Wed Oct 25 16:39:38 MST 2006


SF Markus Elfring wrote:
> All interfaces return an integer. Now I have noticed that the value is
> not needed by the functions "__ast_pthread_mutex_lock",
> "__ast_pthread_mutex_unlock", "__ast_cond_wait" and
> "__ast_cond_timedwait" because the macro "DO_THREAD_CRASH" (abort by
> write access to a null pointer) will be called in the unrecoverable
> error case.
> http://svn.digium.com/view/asterisk/trunk/include/asterisk/lock.h?rev=43953&view=markup

This is not correct. Any users of these functions that wish to inspect
the return values can certainly do so, and there are places in the
source tree that do so already.

> How do you think about to change the return type to "void" for them and
> the corresponding "ast_mutex_..." functions if the preprocessor symbol
> "THREAD_CRASH" is defined? Otherwise, it seems that error codes from
> calls like trylock, lock and unlock will be ignored which might lead to
> thread-unsafe program execution.
> http://bugs.digium.com/view.php?id=8157

Instead of just posting bugs and questions about things that might
possibly be relevant, it might be more appropriate for you to find
specific examples of things that you think are wrong/incorrect and ask
for opinions or assistance on those examples. Open-ended questions like
you are posing will not generate much useful response.


More information about the asterisk-dev mailing list