Index: main/bridging.c =================================================================== --- main/bridging.c (revision 404934) +++ main/bridging.c (working copy) @@ -365,6 +365,16 @@ return 0; } +/*! \brief Wait for stop of Empty bridge */ +static void empty_thread_wait(struct ast_bridge *bridge) +{ + while (!bridge->array_num && !bridge->stop) { + ao2_unlock(bridge); + usleep(50000); + ao2_lock(bridge); + } +} + /*! \brief Bridge thread function */ static void *bridge_thread(void *data) { @@ -380,7 +390,11 @@ ast_debug(1, "Started bridge thread for %p\n", bridge); /* Loop around until we are told to stop */ - while (!bridge->stop && bridge->array_num && !res) { + while (!bridge->stop && !res) { + if (!bridge->array_num) { + empty_thread_wait(bridge); + continue; + } /* In case the refresh bit was set simply set it back to off */ bridge->refresh = 0;