X-Git-Url: http://plrg.eecs.uci.edu/git/?a=blobdiff_plain;f=folly%2FSharedMutex.h;h=b6a1a2639a919e546433482be6f0b7dc5ffa00ea;hb=2c8c7ee0d43110856d9974a925f374a772786bc5;hp=24d8051c4d5e81780610a4d5c83b8084298f6766;hpb=05ce52289b0ec8f525a92d6d1955301d0b77c0a7;p=folly.git diff --git a/folly/SharedMutex.h b/folly/SharedMutex.h index 24d8051c..b6a1a263 100644 --- a/folly/SharedMutex.h +++ b/folly/SharedMutex.h @@ -236,10 +236,11 @@ struct SharedMutexToken { uint16_t slot_; }; -template class Atom = std::atomic, - bool BlockImmediately = false> +template < + bool ReaderPriority, + typename Tag_ = void, + template class Atom = std::atomic, + bool BlockImmediately = false> class SharedMutexImpl { public: static constexpr bool kReaderPriority = ReaderPriority; @@ -849,6 +850,7 @@ class SharedMutexImpl { WaitContext& ctx) { #ifdef RUSAGE_THREAD struct rusage usage; + std::memset(&usage, 0, sizeof(usage)); long before = -1; #endif for (uint32_t yieldCount = 0; yieldCount < kMaxSoftYieldCount; @@ -991,7 +993,7 @@ class SharedMutexImpl { return; } } - asm_pause(); + asm_volatile_pause(); if (UNLIKELY(++spinCount >= kMaxSpinCount)) { applyDeferredReaders(state, ctx, slot); return; @@ -1004,6 +1006,7 @@ class SharedMutexImpl { #ifdef RUSAGE_THREAD struct rusage usage; + std::memset(&usage, 0, sizeof(usage)); long before = -1; #endif for (uint32_t yieldCount = 0; yieldCount < kMaxSoftYieldCount;