X-Git-Url: http://plrg.eecs.uci.edu/git/?a=blobdiff_plain;f=folly%2FAtomicHashArray.h;h=96a647d1a3da6bcf0e0f907273a20da1c09f7a24;hb=c58b599184337ab2a48d96f4f055bc71ecd6ba29;hp=33c59247e38e5bc7e3a80b6b3499a7cbc08a0641;hpb=4e5cb0efba9454e3abb2dd203116ed8e9a056468;p=folly.git diff --git a/folly/AtomicHashArray.h b/folly/AtomicHashArray.h index 33c59247..96a647d1 100644 --- a/folly/AtomicHashArray.h +++ b/folly/AtomicHashArray.h @@ -1,5 +1,5 @@ /* - * Copyright 2015 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. @@ -16,8 +16,8 @@ /** * AtomicHashArray is the building block for AtomicHashMap. It provides the - * core lock-free functionality, but is limitted by the fact that it cannot - * grow past it's initialization size and is a little more awkward (no public + * core lock-free functionality, but is limited by the fact that it cannot + * grow past its initialization size and is a little more awkward (no public * constructor, for example). If you're confident that you won't run out of * space, don't mind the awkardness, and really need bare-metal performance, * feel free to use AHA directly. @@ -29,7 +29,7 @@ * @author Jordan DeLong */ -#ifndef FOLLY_ATOMICHASHARRAY_H_ +#pragma once #define FOLLY_ATOMICHASHARRAY_H_ #include @@ -44,7 +44,9 @@ namespace folly { struct AtomicHashArrayLinearProbeFcn { - inline size_t operator()(size_t idx, size_t numProbes, size_t capacity) const{ + inline size_t operator()(size_t idx, + size_t /* numProbes */, + size_t capacity) const { idx += 1; // linear probing // Avoid modulus because it's slow @@ -75,9 +77,10 @@ class AHAIdentity { }; template -inline void checkLegalKeyIfKeyTImpl(NotKeyT ignored, KeyT emptyKey, - KeyT lockedKey, KeyT erasedKey) { -} +inline void checkLegalKeyIfKeyTImpl(NotKeyT /* ignored */, + KeyT /* emptyKey */, + KeyT /* lockedKey */, + KeyT /* erasedKey */) {} template inline void checkLegalKeyIfKeyTImpl(KeyT key_in, KeyT emptyKey, @@ -173,12 +176,12 @@ class AtomicHashArray : boost::noncopyable { * deleter to make sure everything is cleaned up properly. */ struct Config { - KeyT emptyKey; - KeyT lockedKey; - KeyT erasedKey; + KeyT emptyKey; + KeyT lockedKey; + KeyT erasedKey; double maxLoadFactor; double growthFactor; - int entryCountThreadCacheSize; + uint32_t entryCountThreadCacheSize; size_t capacity; // if positive, overrides maxLoadFactor public: @@ -326,7 +329,7 @@ class AtomicHashArray : boost::noncopyable { numPendingEntries_.setCacheSize(newSize); } - int getEntryCountThreadCacheSize() const { + uint32_t getEntryCountThreadCacheSize() const { return numEntries_.getCacheSize(); } @@ -398,8 +401,13 @@ friend class AtomicHashMap - -#endif // FOLLY_ATOMICHASHARRAY_H_