oneTBB
oneTBB copied to clipboard
Uable to use std::unique_lock with tbb::speculative_spin_mutex with gcc -mrtm on
Uable to use std::unique_lock
with tbb::speculative_spin_mutex
with gcc -mrtm
on.
When I turn on the gcc -mrtm
option, tbb::speculative_spin_mutex
becomes a type alias of tbb::detail::d1::rtm_mutex
, https://github.com/oneapi-src/oneTBB/blob/534428d0f80538f500d524f037373cf61d721caf/include/oneapi/tbb/spin_mutex.h#L126
tbb::detail::d1::rtm_mutex
has a base class tbb::spin_mutex
which is marked as private
, https://github.com/oneapi-src/oneTBB/blob/534428d0f80538f500d524f037373cf61d721caf/include/oneapi/tbb/detail/_rtm_mutex.h#L44
Cause that std::unique_lock
can't access the required lock()
/try_lock()
/unlock()
methods.
@kboyarinov, do I understand correctly that C++11 std::unique_lock
is by design not usable with rtm_mutex
?
@kboyarinov ping
Hi, @Enjoysnow,
As @anton-potapov mentioned, rtm_mutex
is not usable with std::unique_lock
by design because of absence of lock/unlock
methods. Speculation logic in rtm_mutex
is implemented inside of rtm_mutex::scoped_lock
class, so it cannot be locked in other way.
This class can also be used for RAII-locking of speculative_mutex
as it is done with std::unique_lock
.
@Enjoysnow is this issue still relevant for you? Could you please respond?
Closing this issue since no response. Feel free to reopen if any questions are left.