[asterisk-dev] Re: Pthread wrapper updates

SF Markus Elfring elfring at users.sourceforge.net
Thu Oct 26 01:55:45 MST 2006


> 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.

The specified four functions will always return zero if the macro "DO_THREAD_CRASH" results in a program abort (core dump) after an error code was received from a Pthread function. => No return value need to be checked at those call sites.

There are other places (e. g. agent_read, agent_sendtext, odbc_log, odbc_unload_module or ast_replace_sigchld) where error checking was intentionally omitted so far.

I suggest to consider the different design choices that are activated by the symbol "DEBUG_THREADS".


> 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.

Well, I'll try another wording.

An useless and dangerous option is provided by the preprocessor symbol "THREAD_CRASH" in the current file "lock.h" for test purposes.
If this or the symbol "DEBUG_THREADS" are not defined, no abort will be performed in the error case. But such return values will be ignored by a couple of function calls. It will not be noticed that something unexpected happened if error codes will not be checked.

I propose to use abnormal program termination consistently.
Can you see the relevance now?
Does my alternative description show the opportunities for the requested corrections?

Regards,
Markus


More information about the asterisk-dev mailing list