[Live-devel] [EXTERNAL] Re: Possible concurrency issue with triggerEvent()

Ross Finlayson finlayson at live555.com
Wed Jun 7 18:28:56 PDT 2023


OK, the problem here is how we have (tried to) protect access to the “fTriggersAwaitingHandling” variable, in order to make it safely accessible (writeable) by a non-LIVE555 thread.  To date, we have declared this variable as “volatile”, but that isn’t the proper mechanism for inter-thread communication (see, for example, <https://learn.microsoft.com/en-us/cpp/cpp/volatile-cpp?view=msvc-170#iso-conformant>).

Instead, the proper solution will be to define “EventTriggerId” as a “std:atomic_flag”.  To date (for 25+ years), I have avoided using the C++ standard library in the LIVE555 code, mainly because I wanted to accommodate small platforms (e.g., embedded systems) that might need too small a footprint to want to include the standard library.  But that’s probably not a realistic concern anymore.

So, a future release of the LIVE555 code (hopefully coming within about a week) will make this change to define “EventTriggerId” as a “std:atomic_flag”.  (This will be #ifdef’d, so that anyone who wants to use the existing (less safe) “volatile” implementation, without the standard library, can continue to do so.)

Stay tuned...


Ross Finlayson
Live Networks, Inc.
http://www.live555.com/




More information about the live-devel mailing list