[asterisk-dev] fork or pthread_atfork

Tilghman Lesher tilghman at mail.jeffandtilghman.com
Fri Apr 6 08:41:57 MST 2007


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 something that I missed?

You missed the fact that the ast_log() only runs if the fork failed, which
means it can NEVER happen in the child process, only in the parent (and
only when there is no child).

-- 
Tilghman


More information about the asterisk-dev mailing list