[Asterisk-bsd] FreeBSD and Music on Hold -- Possible Fix

Dr. Rich Murphey asterisk-bsd@lists.digium.com
Wed, 23 Jun 2004 11:28:42 -0500


> admin@lists.digium.com] On Behalf Of Chris Stenton
> Ok looking into it further there are two problems.
> 
> Firstly I am using asterisk-current with zaptel 0.4 on FREEBSD 5.2.1-p8
> and
> 2 XEON processors.
> 
> First problem in monmp3thread
> 
> if (class->pseudofd > -1) {
>  /* Pause some amount of time */
>                    res = read(class->pseudofd, buf, sizeof(buf));
> 
> Is happening too fast on my system I need to slow it down by adding
> sleep(1). Is pseudo fully implemented in 0.4 of the  zaptel driver?
> 
> Second problem.
> 
> There is a bug in that calling fork and then execv from within the
> monmp3thread thread to start the mpg123 process puts all other threads in
> blocking mode.
> 
> I have tried to replicate this in a simple threads prog and failed. So all
> I
> can think is that the res_musiconhold shared library is picking up the non
> threaded version of fork?
> 
> Chris

Are you referring to non-blocking IO?

	ldd asterisk 
should show which library is being used.

The -pthread option to gcc causes it to link against libc_r rather than
libc, so as long as either -pthread or -lc_r are used when the asterisk
executable is linked, it should be using the thread safe version.

Rich