[asterisk-dev] Forking after threading

Alexandre Snarskii snar at paranoia.ru
Thu Sep 20 12:33:30 CDT 2007


On Thu, Sep 20, 2007 at 11:46:23AM -0400, Simon Perreault wrote:
> Hi,
> 
> Currently Asterisk's main() does something like this:
> 
> ast_event_init(...);	/* create event thread */
> daemon(0,0);		/* fork */
> pthread_init(...);	/* create other misc. threads */
> 
> This causes Asterisk to not work on FreeBSD. It's a well known bug [1]. 

Strange. On my FreeBSD 6.2-stable Asterisk works just well: 

cccc*CLI> show version 
Asterisk 1.4.11 built by root @ <censored> on a i386 running FreeBSD on 2007-09-11 13:37:14 UTC

Compiled and installed in a standard way through FreeBSD ports collection, 
/usr/ports/net/asterisk. 
Well, port contains some patches against asterisk, but not one you proposing..

PS: looks like modern FreeBSD allows threads to fork - fork used not
only within initial 'daemonizing', but also within at least music-on-hold 
and AGI applications. And I running both and have no problems with.. 




More information about the asterisk-dev mailing list