Index: src/libcfa/concurrency/kernel
===================================================================
--- src/libcfa/concurrency/kernel	(revision bd98b588c3ea1cfcbdb262cfe07a29ade49b0de4)
+++ src/libcfa/concurrency/kernel	(revision 8def349b0537df4d0b760ecaa43ce8f6d6fe9e94)
@@ -22,8 +22,13 @@
 #include "invoke.h"
 
+extern "C" {
+#include <pthread.h>
+}
+
 //-----------------------------------------------------------------------------
 // Cluster
 struct cluster {
 	simple_thread_list ready_queue;
+	pthread_spinlock_t lock;
 };
 
@@ -38,7 +43,10 @@
 	coroutine * current_coroutine;
 	thread_h * current_thread;
-	bool terminated;
+	pthread_t kernel_thread;
+	simple_lock lock;
+	volatile bool terminated;
 };
 
+void ?{}(processor * this);
 void ?{}(processor * this, cluster * cltr);
 void ^?{}(processor * this);
@@ -54,4 +62,41 @@
 void unlock( simple_lock * );
 
+struct pthread_spinlock_guard {
+	pthread_spinlock_t * lock;
+};
+
+static inline void ?{}( pthread_spinlock_guard * this, pthread_spinlock_t * lock ) {
+	this->lock = lock;
+	pthread_spin_lock( this->lock );
+}
+
+static inline void ^?{}( pthread_spinlock_guard * this ) {
+	pthread_spin_unlock( this->lock );
+}
+
+// //Simple spinlock implementation from 
+// //http://stackoverflow.com/questions/1383363/is-my-spin-lock-implementation-correct-and-optimal
+// //Not optimal but correct
+// #define VOL 
+
+// struct simple_spinlock {
+// 	VOL int lock;
+// };
+
+// extern VOL int __sync_lock_test_and_set( VOL int *, VOL int);
+// extern void __sync_synchronize();
+
+// static inline void lock( simple_spinlock * this ) {
+//     while (__sync_lock_test_and_set(&this->lock, 1)) {
+//         // Do nothing. This GCC builtin instruction
+//         // ensures memory barrier.
+//     }
+// }
+
+// static inline void unlock( simple_spinlock * this ) {
+//     __sync_synchronize(); // Memory barrier.
+//     this->lock = 0;
+// }
+
 #endif //KERNEL_H
 
