X-Git-Url: http://plrg.eecs.uci.edu/git/?a=blobdiff_plain;f=folly%2FSharedMutex.h;h=a0f79f5b32ac00e45d0b78a71d8ed9f23a2cb47c;hb=a857f83b2b25f42eeba1524ebca1bd2e74abc71a;hp=24bce0d7c73a9b8328836bb23cd9d3c7eaf811b6;hpb=7c05f8aff907815f30bce0053411a1c181baadc2;p=folly.git diff --git a/folly/SharedMutex.h b/folly/SharedMutex.h index 24bce0d7..a0f79f5b 100644 --- a/folly/SharedMutex.h +++ b/folly/SharedMutex.h @@ -1,5 +1,5 @@ /* - * Copyright 2016 Facebook, Inc. + * Copyright 2017 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -1390,7 +1390,7 @@ bool SharedMutexImpl:: return false; } - uint32_t slot; + uint32_t slot = tls_lastDeferredReaderSlot; uintptr_t slotValue = 1; // any non-zero value will do bool canAlreadyDefer = (state & kMayDefer) != 0; @@ -1399,7 +1399,6 @@ bool SharedMutexImpl:: bool drainInProgress = ReaderPriority && (state & kBegunE) != 0; if (canAlreadyDefer || (aboveDeferThreshold && !drainInProgress)) { /* Try using the most recent slot first. */ - slot = tls_lastDeferredReaderSlot; slotValue = deferredReader(slot)->load(std::memory_order_relaxed); if (slotValue != 0) { // starting point for our empty-slot search, can change after