Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1085)

Unified Diff: Source/wtf/SpinLock.h

Issue 21666003: Enhancements to PartitionAlloc to support threading and arbitrary allocation sizes. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Review items. Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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

Powered by Google App Engine
This is Rietveld 408576698