Index: src/libcfa/bits/locks.h
===================================================================
--- src/libcfa/bits/locks.h	(revision a1a17a744695781ffbd73827d771f9063f9c11ba)
+++ src/libcfa/bits/locks.h	(revision 13073be42dba9d23e1eb3322d700f265381ae024)
@@ -39,18 +39,14 @@
 #endif
 
-#if __SIZEOF_SIZE_T__ == 8
-	#define __lock_test_and_test_and_set( lock ) (lock) == 0 && __sync_lock_test_and_set_8( &(lock), 1 ) == 0
-	#define __lock_release( lock ) __sync_lock_release_8( &(lock) );
-#elif __SIZEOF_SIZE_T__ == 4
-	#define __lock_test_and_test_and_set( lock ) (lock) == 0 && __sync_lock_test_and_set_4( &(lock), 1 ) == 0
-	#define __lock_release( lock ) __sync_lock_release_4( &(lock) );
-#else
-	#error unsupported architecture
-#endif
-
 struct __spinlock_t {
-	__ALIGN__ volatile size_t lock;
+	// Wrap in struct to prevent false sharing with debug info
+	struct {
+		// Align lock on 128-bit boundary
+		__ALIGN__ volatile _Bool lock;
+	};
 	#ifdef __CFA_DEBUG__
+		// previous function to acquire the lock
 		const char * prev_name;
+		// previous thread to acquire the lock
 		void* prev_thrd;
 	#endif
@@ -78,5 +74,5 @@
 	// Lock the spinlock, return false if already acquired
 	static inline _Bool try_lock  ( __spinlock_t & this __cfaabi_dbg_ctx_param2 ) {
-		_Bool result = __lock_test_and_test_and_set( this.lock );
+		_Bool result = (this.lock == 0) && (__atomic_test_and_set( &this.lock, __ATOMIC_ACQUIRE ) == 0);
 		if( result ) {
 			disable_interrupts();
@@ -94,5 +90,5 @@
 
 		for ( unsigned int i = 1;; i += 1 ) {
-			if ( __lock_test_and_test_and_set( this.lock ) ) break;
+			if ( (this.lock == 0) && (__atomic_test_and_set( &this.lock, __ATOMIC_ACQUIRE ) == 0) ) break;
 			#ifndef NOEXPBACK
 				// exponential spin
@@ -112,20 +108,7 @@
 	}
 
-	// // Lock the spinlock, yield if already acquired
-	// static inline void lock_yield( __spinlock_t & this __cfaabi_dbg_ctx_param2 ) {
-	// 	for ( unsigned int i = 1;; i += 1 ) {
-	// 		if ( __lock_test_and_test_and_set( this.lock ) ) break;
-	// 		yield( i );
-	// 	}
-	// 	disable_interrupts();
-	// 	__cfaabi_dbg_debug_do(
-	// 		this.prev_name = caller;
-	// 		this.prev_thrd = this_thread;
-	// 	)
-	// }
-
 	static inline void unlock( __spinlock_t & this ) {
 		enable_interrupts_noPoll();
-		__lock_release( this.lock );
+		__atomic_clear( &this.lock, __ATOMIC_RELEASE );
 	}
 #endif
