Index: libcfa/src/concurrency/kernel.cfa
===================================================================
--- libcfa/src/concurrency/kernel.cfa	(revision 89eff25a464816e7b42a749b35250bba33bd53e8)
+++ libcfa/src/concurrency/kernel.cfa	(revision fb0be05ecf8eb6fa3fe9d0583c7d196e16198bfc)
@@ -115,4 +115,5 @@
 static $thread * __next_thread(cluster * this);
 static $thread * __next_thread_slow(cluster * this);
+static inline bool __must_unpark( $thread * thrd ) __attribute((nonnull(1)));
 static void __run_thread(processor * this, $thread * dst);
 static void __wake_one(cluster * cltr);
@@ -130,4 +131,16 @@
 extern void __disable_interrupts_hard();
 extern void __enable_interrupts_hard();
+
+static inline void __disable_interrupts_checked() {
+	/* paranoid */ verify( __preemption_enabled() );
+	disable_interrupts();
+	/* paranoid */ verify( ! __preemption_enabled() );
+}
+
+static inline void __enable_interrupts_checked( bool poll = true ) {
+	/* paranoid */ verify( ! __preemption_enabled() );
+	enable_interrupts( poll );
+	/* paranoid */ verify( __preemption_enabled() );
+}
 
 //=============================================================================================
@@ -452,5 +465,5 @@
 		if(unlikely(thrd_dst->preempted != __NO_PREEMPTION)) {
 			// The thread was preempted, reschedule it and reset the flag
-			__schedule_thread( thrd_dst );
+			schedule_thread$( thrd_dst );
 			break RUNNING;
 		}
@@ -541,4 +554,5 @@
 	/* paranoid */ verify( ! __preemption_enabled() );
 	/* paranoid */ verify( kernelTLS().this_proc_id );
+	/* paranoid */ verify( ready_schedule_islocked());
 	/* paranoid */ verify( thrd );
 	/* paranoid */ verify( thrd->state != Halted );
@@ -560,13 +574,12 @@
 	__STATS(bool outside = thrd->last_proc && thrd->last_proc != kernelTLS().this_processor; )
 
-	ready_schedule_lock();
-		// push the thread to the cluster ready-queue
-		push( cl, thrd );
-
-		// variable thrd is no longer safe to use
-
-		// wake the cluster using the save variable.
-		__wake_one( cl );
-	ready_schedule_unlock();
+	// push the thread to the cluster ready-queue
+	push( cl, thrd );
+
+	// variable thrd is no longer safe to use
+	thrd = 0xdeaddeaddeaddeadp;
+
+	// wake the cluster using the save variable.
+	__wake_one( cl );
 
 	#if !defined(__CFA_NO_STATISTICS__)
@@ -585,5 +598,12 @@
 	#endif
 
-	/* paranoid */ verify( ! __preemption_enabled() );
+	/* paranoid */ verify( ready_schedule_islocked());
+	/* paranoid */ verify( ! __preemption_enabled() );
+}
+
+void schedule_thread$( $thread * thrd ) {
+	ready_schedule_lock();
+		__schedule_thread( thrd );
+	ready_schedule_unlock();
 }
 
@@ -623,32 +643,14 @@
 }
 
-void unpark( $thread * thrd ) {
-	if( !thrd ) return;
-
+static inline bool __must_unpark( $thread * thrd ) {
 	int old_ticket = __atomic_fetch_add(&thrd->ticket, 1, __ATOMIC_SEQ_CST);
 	switch(old_ticket) {
 		case TICKET_RUNNING:
 			// Wake won the race, the thread will reschedule/rerun itself
-			break;
+			return false;
 		case TICKET_BLOCKED:
 			/* paranoid */ verify( ! thrd->preempted != __NO_PREEMPTION );
 			/* paranoid */ verify( thrd->state == Blocked );
-
-			{
-				/* paranoid */ verify( publicTLS_get(this_proc_id) );
-				disable_interrupts();
-
-				/* paranoid */ verify( ! __preemption_enabled() );
-
-				// Wake lost the race,
-				__schedule_thread( thrd );
-
-				/* paranoid */ verify( ! __preemption_enabled() );
-
-				enable_interrupts_noPoll();
-				/* paranoid */ verify( publicTLS_get(this_proc_id) );
-			}
-
-			break;
+			return true;
 		default:
 			// This makes no sense, something is wrong abort
@@ -657,15 +659,20 @@
 }
 
+void unpark( $thread * thrd ) {
+	if( !thrd ) return;
+
+	if(__must_unpark(thrd)) {
+		disable_interrupts();
+			// Wake lost the race,
+			schedule_thread$( thrd );
+		enable_interrupts(false);
+	}
+}
+
 void park( void ) {
-	/* paranoid */ verify( __preemption_enabled() );
-	disable_interrupts();
-	/* paranoid */ verify( ! __preemption_enabled() );
-	/* paranoid */ verify( kernelTLS().this_thread->preempted == __NO_PREEMPTION );
-
-	returnToKernel();
-
-	/* paranoid */ verify( ! __preemption_enabled() );
-	enable_interrupts( __cfaabi_dbg_ctx );
-	/* paranoid */ verify( __preemption_enabled() );
+	__disable_interrupts_checked();
+		/* paranoid */ verify( kernelTLS().this_thread->preempted == __NO_PREEMPTION );
+		returnToKernel();
+	__enable_interrupts_checked();
 
 }
@@ -707,26 +714,19 @@
 // KERNEL ONLY
 bool force_yield( __Preemption_Reason reason ) {
-	/* paranoid */ verify( __preemption_enabled() );
-	disable_interrupts();
-	/* paranoid */ verify( ! __preemption_enabled() );
-
-	$thread * thrd = kernelTLS().this_thread;
-	/* paranoid */ verify(thrd->state == Active);
-
-	// SKULLDUGGERY: It is possible that we are preempting this thread just before
-	// it was going to park itself. If that is the case and it is already using the
-	// intrusive fields then we can't use them to preempt the thread
-	// If that is the case, abandon the preemption.
-	bool preempted = false;
-	if(thrd->link.next == 0p) {
-		preempted = true;
-		thrd->preempted = reason;
-		returnToKernel();
-	}
-
-	/* paranoid */ verify( ! __preemption_enabled() );
-	enable_interrupts_noPoll();
-	/* paranoid */ verify( __preemption_enabled() );
-
+	__disable_interrupts_checked();
+		$thread * thrd = kernelTLS().this_thread;
+		/* paranoid */ verify(thrd->state == Active);
+
+		// SKULLDUGGERY: It is possible that we are preempting this thread just before
+		// it was going to park itself. If that is the case and it is already using the
+		// intrusive fields then we can't use them to preempt the thread
+		// If that is the case, abandon the preemption.
+		bool preempted = false;
+		if(thrd->link.next == 0p) {
+			preempted = true;
+			thrd->preempted = reason;
+			returnToKernel();
+		}
+	__enable_interrupts_checked( false );
 	return preempted;
 }
@@ -773,10 +773,10 @@
 	__cfadbg_print_safe(runtime_core, "Kernel : waking Processor %p\n", this);
 
-	disable_interrupts();
+	__disable_interrupts_checked();
 		/* paranoid */ verify( ! __preemption_enabled() );
 		eventfd_t val;
 		val = 1;
 		eventfd_write( this->idle, val );
-	enable_interrupts( __cfaabi_dbg_ctx );
+	__enable_interrupts_checked();
 }
 
