[asterisk-dev] Pthread wrapper updates
    SF Markus Elfring 
    elfring at users.sourceforge.net
       
    Wed Oct 25 13:51:36 MST 2006
    
    
  
Hello,
Some Pthread functions were wrapped into a specific API.
http://www.asterisk.org/doxygen/lock_8h.html#_details
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
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
Are any additional tweaks needed for correct error handling?
Regards,
Markus
    
    
More information about the asterisk-dev
mailing list