Review Board 1.7.16

Resolve some race conditions in chan_iax2 scheduler handling

Review Request #131 - Created Jan. 25, 2009 and submitted

Russell Bryant
The main problem with the scheduler handling was that there was improper synchronization between adding new scheduler entries and the handling of calculating how much time until the next task and sleeping for that long.  This patch adjusts the handling of the scheduler lock and condition to avoid the potential for a new scheduler item being added right before the scheduler thread goes to sleep.

The old code minimized the impact of this problem by waking up at least once per second to see if it had work to do.  Now, the code will not wake up any more often than it has to.

This patch is similar to  However, this patch is for 1.4, and is implemented in the least invasive way possible.
It compiles and looks right.  :-)
Ship it!
Posted (Jan. 26, 2009, 4:21 a.m.)
Looks good to me. I'll be putting in a review for your sched thread implementation, soon, too. runs on a server provided by Digium, Inc. and uses bandwidth donated to the open source Asterisk community by API Digital Communications in Huntsville, AL USA.
Please report problems with this site to