[Live-devel] Static Initialization Issues

Jeremiah Morrill Jeremiah.Morrill at econnect.tv
Wed Aug 12 18:59:31 PDT 2015


I’ve come across an issue where a BasicTaskScheduler0 gets statically initialized (ran before main(…)) and the DelayQueue gets stuck in an infinite loop.



I’ve found that the problem is in DelayQueue.cpp in the constructor of DelayQueue.



DelayQueue::DelayQueue()

  : DelayQueueEntry(ETERNITY) {

  fLastSyncTime = TimeNow();

}



Essentially in a statically initialized environment, the ETERNITY const may not have been set and therefor "0".  I'm not sure if this is a scenario you wish to support in your library, but one fix could look like this:



static DelayInterval getEternityDelayInterval()

{

    static const DelayInterval eternity(INT_MAX, MILLION - 1);

    return eternity;

}



DelayQueue::DelayQueue()

  : DelayQueueEntry(getEternityDelayInterval()) {

  fLastSyncTime = TimeNow();

}



In any case, if anyone comes across this issue, they’ll know what is causing it ☺



-Jeremiah
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.live555.com/pipermail/live-devel/attachments/20150813/55af0891/attachment.html>


More information about the live-devel mailing list