[Home]

Summary:ASTERISK-05999: [patch] checking for wrong error value of ast_pthread_create
Reporter:Tzafrir Cohen (tzafrir)Labels:
Date Opened:2006-01-06 17:10:11.000-0600Date Closed:2006-01-07 00:30:12.000-0600
Priority:MinorRegression?No
Status:Closed/CompleteComponents:Core/General
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) pbxspool_pthread_ret.dpatch
Description:ast_pthread_create returns the return of pthread_create . according to its man page This may be -EAGAIN if there are not enough resources to create the thread. EAGAIN defined to be 11 on my system .

pbx_spool.c generates a thread and cheks if the result of ast_create_thread is not -1 . Thus any error value other than -1 will go unnoticed.
Comments:By: Jason Parker (jparker) 2006-01-06 17:23:52.000-0600

Could this not be simplified as follows?

if (ast_pthread_create(&t,&attr,attempt_thread, o)) {

By: Tzafrir Cohen (tzafrir) 2006-01-06 17:47:54.000-0600

Wouldn't you want to record the error that casued the thread generation to fail?

Anyway, is it a good idea to generate exatly the same error message in two separate code locations? Makes tracing the problem from the logs more complicated.

By: Jason Parker (jparker) 2006-01-06 17:51:56.000-0600

As for the first question:

grep -r ast_pthread_create * | grep "=" | wc -l
3

As for the second...yeah, you're probably right.

By: Tilghman Lesher (tilghman) 2006-01-07 00:29:39.000-0600

Committed to 1.2, merged to trunk