[asterisk-dev] AST_FRAME_NULL - what is it?

Moises Silva moises.silva at gmail.com
Fri May 29 11:08:59 CDT 2009


> That makes sense. Even before I dive in to the code to try to find out
> *what* is hanging on to the channel lock, is there some coding
> technique I can apply to my code, to correctly wait for the lock, and/
> or yield to other threads, before I call ast_read, so that I can be
> certain I won't get a AST_FRAME_NULL in return?

ast_channel_lock(chan) will block until it can get the lock, so if you
use that before reading you are certain ast_read will get it as well
(mutex in Asterisk are recursive). However you have not even confirmed
that my guess (ast_read not being able to get the lock) is true, first
I think you should confirm that. If you are developing also be sure to
compile Asterisk as follows

./configure --enable-dev-mode
make menuselect
-> compiler flags
     -> DONT_OPTIMIZE, DEBUG_CHANNEL_LOCKS, DEBUG_THREADS

then you have cli commands such core show locks, core show threads
etc, grep those options in Asterisk source code for more info about
what they do. AFAIR DEBUG_CHANNEL_LOCKS will give you enough info
about who is holding the lock and where was taken.

-- 
Moises Silva
Software Developer
Sangoma Technologies Inc. | 50 McIntosh Drive, Suite 120, Markham ON
L3R 9T3 Canada
t. 1 905 474 1990 x 128 | e. moy at sangoma.com



More information about the asterisk-dev mailing list