[asterisk-dev] [Code Review] New application to wait on the dialplan until a signal is received

Tilghman Lesher reviewboard at asterisk.org
Mon Nov 12 10:50:03 CST 2012


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/2194/#review7380
-----------------------------------------------------------


Speaking as the guy who wrote the LOCK() dialplan function, I'd strongly caution against using primitives directly like this.  When I originally wrote that function, I, too, used the mutex primitives, and I learned that you'll get stuck in situations where you cannot unlock a mutex, because the thread which locked it no longer exists, having been cancelled elsewhere.

There are situations where it just does not function correctly, especially when dealing with things such as channel masquerades.  I'd suggest that you instead use something along the lines of an ast_waitfor() to do the waiting, with lists of threads waiting on named conditions.  This allows cleanup, when channels exit abnormally (such as when a caller hangs up) or after a remote pickup (channel masquerade).

- Tilghman


On Nov. 12, 2012, 10:33 a.m., rcasas wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviewboard.asterisk.org/r/2194/
> -----------------------------------------------------------
> 
> (Updated Nov. 12, 2012, 10:33 a.m.)
> 
> 
> Review request for Asterisk Developers.
> 
> 
> Summary
> -------
> 
> ASTERISK-20635
> 
> 
> Diffs
> -----
> 
>   /asterisk-new/apps/app_waitcond.c PRE-CREATION 
> 
> Diff: https://reviewboard.asterisk.org/r/2194/diff
> 
> 
> Testing
> -------
> 
> 
> Thanks,
> 
> rcasas
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20121112/79f17b82/attachment.htm>


More information about the asterisk-dev mailing list