Re: [asterisk-dev] fork or pthread_atfork

2007-04-06 Thread Yuan Qin
U are careless:), the ast_set_priority() also call some such functions. On 4/6/07, Tilghman Lesher <[EMAIL PROTECTED]> wrote: On Friday 06 April 2007, Yuan Qin wrote: > The ast_log() will lock a mutex if appropriate, but the mutex may be in > locked state already. > Maybe we should use pthread_

Re: [asterisk-dev] fork or pthread_atfork

2007-04-06 Thread Tilghman Lesher
On Friday 06 April 2007, Yuan Qin wrote: > The ast_log() will lock a mutex if appropriate, but the mutex may be in > locked state already. > Maybe we should use pthread_atfork() instead of fork() or never call some > functions that hold mutex > before execv() in child process. > > Is there somethin

Re: [asterisk-dev] fork or pthread_atfork

2007-04-06 Thread Yuan Qin
Yes, you are right, it's my mistake:) the pthread_atfork only register some clean handler. On 4/6/07, Kevin P. Fleming <[EMAIL PROTECTED]> wrote: Yuan Qin wrote: > The ast_log() will lock a mutex if appropriate, but the mutex may be in > locked state already. > Maybe we should use pthread_atf

Re: [asterisk-dev] fork or pthread_atfork

2007-04-06 Thread Kevin P. Fleming
Yuan Qin wrote: > The ast_log() will lock a mutex if appropriate, but the mutex may be in > locked state already. > Maybe we should use pthread_atfork() instead of fork() or never call > some functions that hold mutex > before execv() in child process. pthread_atfork() does not fork, it does some

[asterisk-dev] fork or pthread_atfork

2007-04-06 Thread Yuan Qin
Hi, all I found that code in res_agi.c(version of 1.2.13) called fork() to create an AGI process, however, fork() is not a safe function in Linux multi-thread environment because the child process only hold one thread that made from a copy of the calling thread but inherit all the mutex or co