[asterisk-dev] Help, can't get out of while loop

Killian Matter matter.killian at gmail.com
Thu Jan 14 04:09:57 CST 2021


It seems that nothing else change it's status, i ran the loop for more than
15 minutes and still, no change of status.

Killian Matter

Le jeu. 14 janv. 2021 à 10:02, Dennis Buteyn <dennis.buteyn at xorcom.com> a
écrit :

> That loop is equivalent to:
>
> audiohook->status = AST_AUDIOHOOK_STATUS_SHUTDOWN;
> while (audiohook->status != AST_AUDIOHOOK_STATUS_DONE) {
>     sleep(...);
> }
>
> Something else (in another thread) must change the status in order for
> that loop to terminate.
>
> Side note: that struct member probably should be marked volatile, I can
> imagine very eager compilers assuming that status never changes and optimizing
> that code into a real infinite loop.
>
> Dennis Buteyn
> Xorcom Ltd
>
> On 1/14/21 10:00 AM, Killian Matter wrote:
>
> Hello ,
>
> I'm developing a module on asterisk, while debugging i've come across a
> problem I don't quite understand.
> I'm using a noise filter, at the end of the call I stop my filter , so
> clean up everything, detach the audiohook and there is the problem. It's
> stuck in the while loop in *ast_audiohook_detach*.
> As far as I understand, to detach audiohook, the status should not be
> *NEW* nor *DONE*, then it's update its status to *SHUTDOWN* which will
> then put it to *DONE*, so why does it get stuck in the while loop and
> don't update it's status to *DONE* ?
>
> Thank you in advance for your help.
> K.M
>
> --
> _____________________________________________________________________
> -- Bandwidth and Colocation Provided by http://www.api-digital.com --
>
> asterisk-dev mailing list
> To UNSUBSCRIBE or update options visit:
>    http://lists.digium.com/mailman/listinfo/asterisk-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20210114/afe86fef/attachment.html>


More information about the asterisk-dev mailing list