Chromium Code Reviews| Index: Source/wtf/SpinLock.h |
| diff --git a/Source/wtf/HashTableDeletedValueType.h b/Source/wtf/SpinLock.h |
| similarity index 80% |
| copy from Source/wtf/HashTableDeletedValueType.h |
| copy to Source/wtf/SpinLock.h |
| index 450f387ff7bffb861c0be030a009992dc8538b92..1deb33dab0fd93c0eaccb6c39b68370d912a5bdf 100644 |
| --- a/Source/wtf/HashTableDeletedValueType.h |
| +++ b/Source/wtf/SpinLock.h |
| @@ -28,13 +28,29 @@ |
| * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| */ |
| -#ifndef HashTableDeletedValueType_h |
| -#define HashTableDeletedValueType_h |
| +#ifndef WTF_SpinLock_h |
| +#define WTF_SpinLock_h |
| + |
| +// DESCRIPTION |
|
abarth-chromium
2013/08/05 20:40:25
"DESCRIPTION" ?
|
| + |
| +#include "wtf/Atomics.h" |
| namespace WTF { |
| -enum HashTableDeletedValueType { HashTableDeletedValue }; |
| +ALWAYS_INLINE void spinLockLock(int volatile* lock) |
| +{ |
| + while (atomicIncrement(lock) != 1) |
| + atomicDecrement(lock); |
| +} |
| + |
| +ALWAYS_INLINE void spinLockUnlock(int volatile* lock) |
| +{ |
| + atomicDecrement(lock); |
| +} |
| } // namespace WTF |
| -#endif // HashTableDeletedValueType_h |
| +using WTF::spinLockLock; |
| +using WTF::spinLockUnlock; |
| + |
| +#endif // WTF_PartitionAlloc_h |