[Live-devel] Use of std::atomic_flag
Dmitry Bely
d.bely at recognize.ru
Wed Nov 29 07:14:07 PST 2023
Hi,
Recent versions of live555 use std::atomic_flag array to work with
event triggers. Consider the following code fragment:
#ifndef NO_STD_LIB
if (fTriggersAwaitingHandling[i].test()) {
fTriggersAwaitingHandling[i].clear();
#else
It is problematic in two ways: 1) it's not atomic: the value can be
changed elsewhere between test() and clear() and 2) it requires
C++>=20. This can be easily fixed by replacing std::atomic_flag with
std::atomic_bool, that needs just C++11. The patch is attached, maybe
you find it useful.
- Dmitry Bely
-------------- next part --------------
A non-text attachment was scrubbed...
Name: atomic.patch
Type: application/x-patch
Size: 1886 bytes
Desc: not available
URL: <http://lists.live555.com/pipermail/live-devel/attachments/20231129/8801d15a/attachment.bin>
More information about the live-devel
mailing list