[asterisk-dev] fork or pthread_atfork

Kevin P. Fleming kpfleming at digium.com
Fri Apr 6 08:18:00 MST 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.

pthread_atfork() does not fork, it does something entirely different.
Read the man page before suggesting we use it :-)

However, you have raised a very valid point... we cannot use
pthread-related functions for synchronization after forking, because we
are not running in the same process any longer. I will have someone look
into this, thanks for raising the issue!

More information about the asterisk-dev mailing list