[Live-devel] Possible issue in DelayQueue
Ross Finlayson
finlayson at live555.com
Wed Jan 11 11:19:54 PST 2023
> On Jan 11, 2023, at 8:59 AM, Hansen Jan Rørgård <jan.r.hansen at dk.saabgroup.com> wrote:
>
> Hi,
> In the liveMedia FAQ section: ”Is this code 'thread safe'? I.e., can it be accessed by more than one thread at the same time?”, it is stated that:
> “…Another possible way to access the code from multiple threads is to have each thread use its own "UsageEnvironment" and "TaskScheduler" objects, and thus its own event loop.”
> I know that it is not recommended to use this approach
Yes, and you discovered a reason why: The code might inadvertently make use of shared (or static) variables that can cause problems with multiple threads :-)
> Do you also see an issue here?
Yes. I have just installed a new version (2023-01-11) of the code that moves the ’token counter’ to be a field of the ’task scheduler’ object, so that it will no longer be shared by multiple threads. This should avoid this problem.
Thanks for the report.
Ross Finlayson
Live Networks, Inc.
http://www.live555.com/
More information about the live-devel
mailing list