You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For this reason, the function above contains two implementations, depending on whether __cpp_lib_atomic_shared_ptr is supported.
Both implementations are problematic:
The implementation is not thread-safe when __cpp_lib_atomic_shared_ptr is unsupported. The object would need to carry a pointer to mutex for that.
The implementation when __cpp_lib_atomic_shared_ptr is supported is also unsafe because the load and exchange operations are independent. This means two concurrent threads will attempt to construct the object twice if they call the function before the object is constructed.
The text was updated successfully, but these errors were encountered:
Most compilers don't implement
__cpp_lib_atomic_shared_ptr
, on whichLazyObjectImpl
depends:mrdocs/src/lib/Dom/Object.cpp
Lines 216 to 232 in a962db0
For this reason, the function above contains two implementations, depending on whether
__cpp_lib_atomic_shared_ptr
is supported.Both implementations are problematic:
__cpp_lib_atomic_shared_ptr
is unsupported. The object would need to carry a pointer to mutex for that.__cpp_lib_atomic_shared_ptr
is supported is also unsafe because the load and exchange operations are independent. This means two concurrent threads will attempt to construct the object twice if they call the function before the object is constructed.The text was updated successfully, but these errors were encountered: