Commit d33f356c authored by Maged Michael's avatar Maged Michael Committed by Facebook GitHub Bot

SharedMutex: Remove single-use intermediate constants

Summary: Remove single-use intermediate constants from SharedMutexImpl

Reviewed By: yfeldblum, ot

Differential Revision: D29934333

fbshipit-source-id: 5e4157fa1e6576f0fa9f2a2a10a32f0e1e24d7f5
parent c3c6b788
...@@ -337,14 +337,11 @@ class SharedMutexImpl : std::conditional_t< ...@@ -337,14 +337,11 @@ class SharedMutexImpl : std::conditional_t<
shared_mutex_detail::ThreadIdOwnershipTracker, shared_mutex_detail::ThreadIdOwnershipTracker,
shared_mutex_detail::NopOwnershipTracker> { shared_mutex_detail::NopOwnershipTracker> {
private: private:
static constexpr uint32_t MaxSpinCount = Policy::max_spin_count;
static constexpr uint32_t MaxSoftYieldCount = Policy::max_soft_yield_count;
static constexpr bool AnnotateForThreadSanitizer = static constexpr bool AnnotateForThreadSanitizer =
kIsSanitizeThread && !ReaderPriority && !Policy::skip_annotate_rwlock; kIsSanitizeThread && !ReaderPriority && !Policy::skip_annotate_rwlock;
static constexpr bool TrackThreadId = Policy::track_thread_id;
typedef std::conditional_t< typedef std::conditional_t<
TrackThreadId, Policy::track_thread_id,
shared_mutex_detail::ThreadIdOwnershipTracker, shared_mutex_detail::ThreadIdOwnershipTracker,
shared_mutex_detail::NopOwnershipTracker> shared_mutex_detail::NopOwnershipTracker>
OwnershipTrackerBase; OwnershipTrackerBase;
...@@ -912,7 +909,7 @@ class SharedMutexImpl : std::conditional_t< ...@@ -912,7 +909,7 @@ class SharedMutexImpl : std::conditional_t<
// The typical number of spins that a thread will wait for a state // The typical number of spins that a thread will wait for a state
// transition. // transition.
static constexpr uint32_t kMaxSpinCount = MaxSpinCount; static constexpr uint32_t kMaxSpinCount = Policy::max_spin_count;
// The maximum number of soft yields before falling back to futex. // The maximum number of soft yields before falling back to futex.
// If the preemption heuristic is activated we will fall back before // If the preemption heuristic is activated we will fall back before
...@@ -920,7 +917,7 @@ class SharedMutexImpl : std::conditional_t< ...@@ -920,7 +917,7 @@ class SharedMutexImpl : std::conditional_t<
// to getrusage, with checks of the goal at each step). Soft yields // to getrusage, with checks of the goal at each step). Soft yields
// aren't compatible with deterministic execution under test (unlike // aren't compatible with deterministic execution under test (unlike
// futexWaitUntil, which has a capricious but deterministic back end). // futexWaitUntil, which has a capricious but deterministic back end).
static constexpr uint32_t kMaxSoftYieldCount = MaxSoftYieldCount; static constexpr uint32_t kMaxSoftYieldCount = Policy::max_soft_yield_count;
// If AccessSpreader assigns indexes from 0..k*n-1 on a system where some // If AccessSpreader assigns indexes from 0..k*n-1 on a system where some
// level of the memory hierarchy is symmetrically divided into k pieces // level of the memory hierarchy is symmetrically divided into k pieces
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment