[Live-devel] correct way to use TaskScheduler::unscheduleDelayedTask?
Helmut Grohne
h.grohne at intenta.de
Wed Aug 24 04:40:27 PDT 2016
On Tue, Aug 23, 2016 at 05:14:04PM +0200, Ross Finlayson wrote:
> Furthermore, once a ‘scheduled task’ has occurred, its ‘TaskToken’ is no longer valid, and should not be used again. Therefore, you MUST NOT call “unscheduleDelayedTask()” (or “rescheduleDelayedTask()”) on a ‘TaskToken’ after its scheduled task has occurred.
I am attaching a patch[1] that makes libliveMedia follow this rule. Its
main work is carefully placing NULL assignments to TaskTokens to avoid
unscheduling expired tokens.
In that process the API of FramedSource is broken, because the sematics
of FramedSource::afterGetting are undefined. The static method is
replaced with two non-static methods afterGetting and
scheduleAfterGetting. Users of the static afterGetting must migrate to
either of the non-static replacements. Do you see a way of fixing this
without breaking the API?
Furthermore, I moved some methods to private that seemed to be public by
accident. This also constitutes an API break, but not exposing them
seemed saner to me. Feel free to revert this part of the patch.
The patch does not explicitly break ABI, but due to changing the
behaviour of the static FramedSource::afterGetting (which now clears
fNextToken), it may fail to unschedule tasks that previously could be
unscheduled. Since the previous behaviour was undefined, I don't
consider this an ABI break.
The patch makes my double frees go away, but some more review certainly
is in order.
Helmut
[1] Consider it appropriately licensed LGPL-2+.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: live555.patch
Type: text/x-diff
Size: 27635 bytes
Desc: not available
URL: <http://lists.live555.com/pipermail/live-devel/attachments/20160824/22287376/attachment.bin>
More information about the live-devel
mailing list