Index: libcfa/src/concurrency/locks.cfa
===================================================================
--- libcfa/src/concurrency/locks.cfa	(revision eeb50239e4a8b96e536a3593aa8655e49d67a93e)
+++ libcfa/src/concurrency/locks.cfa	(revision c5bbb9b954e58b4aeb28451ae617740c890cb1d3)
@@ -236,5 +236,5 @@
 forall(dtype L | is_blocking_lock(L)) {
 
-	void timeout_handler ( condition_variable(L) * cond , info_thread(L) ** i ) {
+	void timeout_handler ( alarm_node_wrap(L) & this ) with( this ) {
     	// This condition_variable member is called from the kernel, and therefore, cannot block, but it can spin.
 	    lock( cond->lock __cfaabi_dbg_ctx2 );
@@ -242,12 +242,11 @@
 	    	info_thread(L) * copy = *i;
 			remove( cond->blocked_threads, i );		 //remove this thread O(1)
+			cond->wait_count--;
 			if( !copy->lock ) {
 				unlock( cond->lock );
-				printf("here");
 				#if !defined( __CFA_NO_STATISTICS__ )
 					kernelTLS.this_stats = copy->t->curr_cluster->stats;
 				#endif
 				unpark( copy->t );
-				printf("here2");
 	    	} else {
 	    		add_(*copy->lock, copy->t);			// call lock's add_
@@ -257,10 +256,6 @@
 	}
 
-	void alarm_node_callback( alarm_node_wrap(L) & this ) with( this ) {
-		timeout_handler(cond, i);
-	}
-
 	void alarm_node_wrap_cast( alarm_node_t & a ) {
-		alarm_node_callback( (alarm_node_wrap(L) &)a );
+		timeout_handler( (alarm_node_wrap(L) &)a );
 	}
 
@@ -289,6 +284,10 @@
 		popped->listed = false;
 		if(popped != 0p) {
-			add_(*popped->lock, popped->t);
 			count--;
+			if (popped->lock) {
+				add_(*popped->lock, popped->t);
+			} else {
+				unpark(popped->t);
+			}
 		}
 		unlock( lock );
@@ -303,6 +302,10 @@
 			popped->listed = false;
 			if(popped != 0p){
-				add_(*popped->lock, popped->t);
 				count--;
+				if (popped->lock) {
+					add_(*popped->lock, popped->t);
+				} else {
+					unpark(popped->t);
+				}
 			}
 		}
@@ -436,54 +439,2 @@
 	}
 }
-
-thread T1 {};
-thread T2 {};
-
-recursive_mutex_lock m;
-condition_variable( recursive_mutex_lock ) c;
-
-void main( T1 & this ) {
-	printf("T1 start\n");
-	lock(m);
-	printf("%d\n", counter(c));
-	if(empty(c)) {
-		printf("T1 wait\n");
-		wait(c,m,12);
-	}else{
-		printf("%d\n", front(c));
-		notify_one(c);
-	}
-	unlock(m);
-	printf("curr thd in main %p \n", kernelTLS.this_thread);
-	printf("T1 waits for 2s\n");
-	lock(m);
-	wait( c, m, 2`s );
-	unlock(m);
-	printf("T1 wakes\n");
-	printf("T1 done\n");
-}
-
-void main( T2 & this ) {
-	printf("T2 start\n");
-	lock(m);
-	printf("%d\n", counter(c));
-	if(empty(c)) {
-		printf("T2 wait\n");
-		wait(c,m,12);
-	}else{
-		printf("%d\n", front(c));
-		notify_one(c);
-	}
-	unlock(m);
-	printf("T2 done\n");
-}
-
-int main() {
-	printf("start\n");
-	processor p[2];
-	{
-		T1 t1;
-		T2 t2;
-	}
-	printf("done\n");
-}
