[asterisk-dev] Seeking built-in channel waiter function

Kevin P. Fleming kpfleming at digium.com
Thu Oct 6 10:20:19 CDT 2011


On 10/06/2011 10:08 AM, Yaroslav Panych wrote:
> Ok, then.
> What about adding new custom frame type? Like AST_FRAME_MYSUPERFRAME?
> Then in my worker thread I will queue it into channel(instead of
> signaling sync object), and in channel thread I can use simple
> ast_waitfor and analyse returned frame type. How much code I should
> change in asterisk to let it to deliver it without any losts?

There are already mechanisms used in Asterisk to do what you want; 
search for 'alertpipe'. We create a pipe and put one end of it on the 
channel in the chan->fds array, and then ast_waitfor() will wake up when 
data is written to that pipe and the caller of ast_waitfor() can check 
which fd was the reason for the wakeup.

-- 
Kevin P. Fleming
Digium, Inc. | Director of Software Technologies
Jabber: kfleming at digium.com | SIP: kpfleming at digium.com | Skype: kpfleming
445 Jan Davis Drive NW - Huntsville, AL 35806 - USA
Check us out at www.digium.com & www.asterisk.org



More information about the asterisk-dev mailing list