Index: src/CodeGen/CodeGenerator.cc
===================================================================
--- src/CodeGen/CodeGenerator.cc	(revision f57668a590aa4cede590bc26725f85c38abb833a)
+++ src/CodeGen/CodeGenerator.cc	(revision c3528933d5f11e2e63ae14ac55903fbf6e42e2bd)
@@ -262,5 +262,8 @@
 			} // if
 		} else {
-			output << typeDecl->typeString() << " " << typeDecl->get_name();
+			output << typeDecl->genTypeString() << " " << typeDecl->get_name();
+			if ( typeDecl->get_kind() != TypeDecl::Any && typeDecl->get_sized() ) {
+				output << " | sized(" << typeDecl->get_name() << ")";
+			}
 			if ( ! typeDecl->get_assertions().empty() ) {
 				output << " | { ";
@@ -769,6 +772,9 @@
 	void CodeGenerator::visit( ExprStmt * exprStmt ) {
 		assert( exprStmt );
-		// cast the top-level expression to void to reduce gcc warnings.
-		Expression * expr = new CastExpr( exprStmt->get_expr() );
+		Expression * expr = exprStmt->get_expr();
+		if ( genC ) {
+			// cast the top-level expression to void to reduce gcc warnings.
+			expr = new CastExpr( expr );
+		}
 		expr->accept( *this );
 		output << ";";
Index: src/CodeGen/Generate.cc
===================================================================
--- src/CodeGen/Generate.cc	(revision f57668a590aa4cede590bc26725f85c38abb833a)
+++ src/CodeGen/Generate.cc	(revision c3528933d5f11e2e63ae14ac55903fbf6e42e2bd)
@@ -22,5 +22,9 @@
 #include "SynTree/Declaration.h"
 #include "CodeGenerator.h"
-#include "Tuples/Tuples.h"
+#include "GenType.h"
+#include "SynTree/SynTree.h"
+#include "SynTree/Type.h"
+#include "SynTree/BaseSyntaxNode.h"
+// #include "Tuples/Tuples.h"
 
 using namespace std;
@@ -39,4 +43,14 @@
 		} // for
 	}
+
+	void generate( BaseSyntaxNode * node, std::ostream & os ) {
+		if ( Type * type = dynamic_cast< Type * >( node ) ) {
+			os << CodeGen::genPrettyType( type, "" );
+		} else {
+			CodeGen::CodeGenerator cgv( os, true, false );
+			node->accept( cgv );
+		}
+		os << std::endl;
+	}
 } // namespace CodeGen
 
Index: src/CodeGen/Generate.h
===================================================================
--- src/CodeGen/Generate.h	(revision f57668a590aa4cede590bc26725f85c38abb833a)
+++ src/CodeGen/Generate.h	(revision c3528933d5f11e2e63ae14ac55903fbf6e42e2bd)
@@ -25,4 +25,7 @@
 	/// Generates code. doIntrinsics determines if intrinsic functions are printed, pretty formats output nicely (e.g., uses unmangled names, etc.), generateC is true when the output must consist only of C code (allows some assertions, etc.)
 	void generate( std::list< Declaration* > translationUnit, std::ostream &os, bool doIntrinsics, bool pretty, bool generateC = false );
+
+	/// Generate code for a single node -- helpful for debugging in gdb
+	void generate( BaseSyntaxNode * node, std::ostream & os );
 } // namespace CodeGen
 
Index: src/Concurrency/Keywords.cc
===================================================================
--- src/Concurrency/Keywords.cc	(revision f57668a590aa4cede590bc26725f85c38abb833a)
+++ src/Concurrency/Keywords.cc	(revision c3528933d5f11e2e63ae14ac55903fbf6e42e2bd)
@@ -246,4 +246,5 @@
 	//=============================================================================================
 	void ConcurrentSueKeyword::visit(StructDecl * decl) {
+		Visitor::visit(decl);
 		if( decl->get_name() == type_name ) {
 			assert( !type_decl );
@@ -385,4 +386,6 @@
 	//=============================================================================================
 	void MutexKeyword::visit(FunctionDecl* decl) {
+		Visitor::visit(decl);		
+
 		std::list<DeclarationWithType*> mutexArgs = findMutexArgs( decl );
 		if( mutexArgs.empty() ) return;
@@ -402,4 +405,6 @@
 
 	void MutexKeyword::visit(StructDecl* decl) {
+		Visitor::visit(decl);
+
 		if( decl->get_name() == "monitor_desc" ) {
 			assert( !monitor_decl );
@@ -504,4 +509,6 @@
 	//=============================================================================================
 	void ThreadStarter::visit(FunctionDecl * decl) {
+		Visitor::visit(decl);
+		
 		if( ! InitTweak::isConstructor(decl->get_name()) ) return;
 
Index: src/GenPoly/PolyMutator.cc
===================================================================
--- src/GenPoly/PolyMutator.cc	(revision f57668a590aa4cede590bc26725f85c38abb833a)
+++ src/GenPoly/PolyMutator.cc	(revision c3528933d5f11e2e63ae14ac55903fbf6e42e2bd)
@@ -50,4 +50,11 @@
 
 	Statement * PolyMutator::mutateStatement( Statement *stmt ) {
+		// don't want statements from outer CompoundStmts to be added to this CompoundStmt
+		ValueGuard< std::list< Statement* > > oldStmtsToAdd( stmtsToAdd );
+		ValueGuard< std::list< Statement* > > oldStmtsToAddAfter( stmtsToAddAfter );
+		ValueGuard< TypeSubstitution * > oldEnv( env );
+		stmtsToAdd.clear();
+		stmtsToAddAfter.clear();
+
 		Statement *newStmt = maybeMutate( stmt, *this );
 		if ( ! stmtsToAdd.empty() || ! stmtsToAddAfter.empty() ) {
@@ -83,33 +90,33 @@
 
 	Statement * PolyMutator::mutate(IfStmt *ifStmt) {
+		ifStmt->set_condition(  mutateExpression( ifStmt->get_condition() ) );
 		ifStmt->set_thenPart(  mutateStatement( ifStmt->get_thenPart() ) );
 		ifStmt->set_elsePart(  mutateStatement( ifStmt->get_elsePart() ) );
-		ifStmt->set_condition(  mutateExpression( ifStmt->get_condition() ) );
 		return ifStmt;
 	}
 
 	Statement * PolyMutator::mutate(WhileStmt *whileStmt) {
+		whileStmt->set_condition(  mutateExpression( whileStmt->get_condition() ) );
 		whileStmt->set_body(  mutateStatement( whileStmt->get_body() ) );
-		whileStmt->set_condition(  mutateExpression( whileStmt->get_condition() ) );
 		return whileStmt;
 	}
 
 	Statement * PolyMutator::mutate(ForStmt *forStmt) {
-		forStmt->set_body(  mutateStatement( forStmt->get_body() ) );
 		mutateAll( forStmt->get_initialization(), *this );
 		forStmt->set_condition(  mutateExpression( forStmt->get_condition() ) );
 		forStmt->set_increment(  mutateExpression( forStmt->get_increment() ) );
+		forStmt->set_body(  mutateStatement( forStmt->get_body() ) );
 		return forStmt;
 	}
 
 	Statement * PolyMutator::mutate(SwitchStmt *switchStmt) {
+		switchStmt->set_condition( mutateExpression( switchStmt->get_condition() ) );
 		mutateStatementList( switchStmt->get_statements() );
-		switchStmt->set_condition( mutateExpression( switchStmt->get_condition() ) );
 		return switchStmt;
 	}
 
 	Statement * PolyMutator::mutate(CaseStmt *caseStmt) {
+		caseStmt->set_condition(  mutateExpression( caseStmt->get_condition() ) );
 		mutateStatementList( caseStmt->get_statements() );
-		caseStmt->set_condition(  mutateExpression( caseStmt->get_condition() ) );
 		return caseStmt;
 	}
Index: src/ResolvExpr/AlternativeFinder.cc
===================================================================
--- src/ResolvExpr/AlternativeFinder.cc	(revision f57668a590aa4cede590bc26725f85c38abb833a)
+++ src/ResolvExpr/AlternativeFinder.cc	(revision c3528933d5f11e2e63ae14ac55903fbf6e42e2bd)
@@ -766,13 +766,16 @@
 			} // if
 		} // for
-		// function may return struct or union value, in which case we need to add alternatives for implicit conversions to each of the anonymous members
+
+		candidates.clear();
+		candidates.splice( candidates.end(), alternatives );
+
+		findMinCost( candidates.begin(), candidates.end(), std::back_inserter( alternatives ) );
+
+		// function may return struct or union value, in which case we need to add alternatives for implicit
+		// conversions to each of the anonymous members, must happen after findMinCost since anon conversions
+		// are never the cheapest expression
 		for ( const Alternative & alt : alternatives ) {
 			addAnonConversions( alt );
 		}
-
-		candidates.clear();
-		candidates.splice( candidates.end(), alternatives );
-
-		findMinCost( candidates.begin(), candidates.end(), std::back_inserter( alternatives ) );
 
 		if ( alternatives.empty() && targetType && ! targetType->isVoid() ) {
Index: src/SynTree/BaseSyntaxNode.h
===================================================================
--- src/SynTree/BaseSyntaxNode.h	(revision f57668a590aa4cede590bc26725f85c38abb833a)
+++ src/SynTree/BaseSyntaxNode.h	(revision c3528933d5f11e2e63ae14ac55903fbf6e42e2bd)
@@ -18,8 +18,11 @@
 
 #include "Common/utility.h"
+#include "Visitor.h"
 
 class BaseSyntaxNode {
   public:
 	CodeLocation location;
+
+	virtual void accept( Visitor & v ) = 0; // temporary -- needs to be here so that BaseSyntaxNode is polymorphic and can be dynamic_cast
 };
 
Index: src/SynTree/Declaration.h
===================================================================
--- src/SynTree/Declaration.h	(revision f57668a590aa4cede590bc26725f85c38abb833a)
+++ src/SynTree/Declaration.h	(revision c3528933d5f11e2e63ae14ac55903fbf6e42e2bd)
@@ -204,4 +204,5 @@
 
 	virtual std::string typeString() const;
+	virtual std::string genTypeString() const;
 
 	virtual TypeDecl *clone() const { return new TypeDecl( *this ); }
Index: src/SynTree/SynTree.h
===================================================================
--- src/SynTree/SynTree.h	(revision f57668a590aa4cede590bc26725f85c38abb833a)
+++ src/SynTree/SynTree.h	(revision c3528933d5f11e2e63ae14ac55903fbf6e42e2bd)
@@ -21,4 +21,6 @@
 #include <map>
 #include <iostream>
+
+class BaseSyntaxNode;
 
 class Declaration;
Index: src/SynTree/TypeDecl.cc
===================================================================
--- src/SynTree/TypeDecl.cc	(revision f57668a590aa4cede590bc26725f85c38abb833a)
+++ src/SynTree/TypeDecl.cc	(revision c3528933d5f11e2e63ae14ac55903fbf6e42e2bd)
@@ -29,4 +29,9 @@
 }
 
+std::string TypeDecl::genTypeString() const {
+	static const std::string kindNames[] = { "otype", "dtype", "ftype", "ttype" };
+	return kindNames[ kind ];
+}
+
 std::ostream & operator<<( std::ostream & os, const TypeDecl::Data & data ) {
   return os << data.kind << ", " << data.isComplete;
Index: src/benchmark/CorCtxSwitch.c
===================================================================
--- src/benchmark/CorCtxSwitch.c	(revision f57668a590aa4cede590bc26725f85c38abb833a)
+++ src/benchmark/CorCtxSwitch.c	(revision c3528933d5f11e2e63ae14ac55903fbf6e42e2bd)
@@ -3,23 +3,5 @@
 #include <thread>
 
-#include <unistd.h>					// sysconf
-#include <sys/times.h>					// times
-#include <time.h>
-
-inline unsigned long long int Time() {
-    timespec ts;
-    clock_gettime(
-#if defined( __linux__ )
-	 CLOCK_THREAD_CPUTIME_ID,
-#elif defined( __freebsd__ )
-	 CLOCK_PROF,
-#elif defined( __solaris__ )
-	 CLOCK_HIGHRES,
-#else
-    #error uC++ : internal error, unsupported architecture
-#endif
-	 &ts );
-    return 1000000000LL * ts.tv_sec + ts.tv_nsec;
-} // Time
+#include "bench.h"
 
 coroutine GreatSuspender {};
@@ -42,8 +24,4 @@
 }
 
-#ifndef N
-#define N 100000000
-#endif
-
 int main() {
 	const unsigned int NoOfTimes = N;
Index: src/benchmark/Makefile.am
===================================================================
--- src/benchmark/Makefile.am	(revision f57668a590aa4cede590bc26725f85c38abb833a)
+++ src/benchmark/Makefile.am	(revision c3528933d5f11e2e63ae14ac55903fbf6e42e2bd)
@@ -44,4 +44,18 @@
 	@rm -f ./a.out
 
+sched-int:
+	${CC} ${AM_CFLAGS} ${CFLAGS} ${ccflags} @CFA_FLAGS@ -nodebug -lrt -DN=10000000 SchedInt.c
+	@for number in 1 2 3 4 5 6 7 8 9 10; do \
+                ./a.out ; \
+        done
+	@rm -f ./a.out
+
+monitor:
+	${CC} ${AM_CFLAGS} ${CFLAGS} ${ccflags} @CFA_FLAGS@ -nodebug -lrt -DN=10000000 Monitor.c
+	@for number in 1 2 3 4 5 6 7 8 9 10; do \
+                ./a.out ; \
+        done
+	@rm -f ./a.out
+
 csv-data:
 	@${CC} ${AM_CFLAGS} ${CFLAGS} ${ccflags} @CFA_FLAGS@ -nodebug -lrt -quiet -DN=10000000 csv-data.c
Index: src/benchmark/Makefile.in
===================================================================
--- src/benchmark/Makefile.in	(revision f57668a590aa4cede590bc26725f85c38abb833a)
+++ src/benchmark/Makefile.in	(revision c3528933d5f11e2e63ae14ac55903fbf6e42e2bd)
@@ -492,4 +492,18 @@
 	@rm -f ./a.out
 
+sched-int:
+	${CC} ${AM_CFLAGS} ${CFLAGS} ${ccflags} @CFA_FLAGS@ -nodebug -lrt -DN=10000000 SchedInt.c
+	@for number in 1 2 3 4 5 6 7 8 9 10; do \
+                ./a.out ; \
+        done
+	@rm -f ./a.out
+
+monitor:
+	${CC} ${AM_CFLAGS} ${CFLAGS} ${ccflags} @CFA_FLAGS@ -nodebug -lrt -DN=10000000 Monitor.c
+	@for number in 1 2 3 4 5 6 7 8 9 10; do \
+                ./a.out ; \
+        done
+	@rm -f ./a.out
+
 csv-data:
 	@${CC} ${AM_CFLAGS} ${CFLAGS} ${ccflags} @CFA_FLAGS@ -nodebug -lrt -quiet -DN=10000000 csv-data.c
Index: src/benchmark/Monitor.c
===================================================================
--- src/benchmark/Monitor.c	(revision c3528933d5f11e2e63ae14ac55903fbf6e42e2bd)
+++ src/benchmark/Monitor.c	(revision c3528933d5f11e2e63ae14ac55903fbf6e42e2bd)
@@ -0,0 +1,32 @@
+#include <fstream>
+#include <stdlib>
+#include <thread>
+
+#include "bench.h"
+
+monitor mon_t {};
+
+mon_t mon1, mon2;
+
+void dummy( mon_t * mutex a ) {}
+void dummy( mon_t * mutex a, mon_t * mutex b ) {}
+
+int main() {
+	long long int StartTime, EndTime;
+
+	StartTime = Time();
+	for( int i = 0; i < N; i++ ) {
+		dummy( &mon1 );
+	}
+	EndTime = Time();
+
+	sout | ( EndTime - StartTime ) / N;
+
+	StartTime = Time();
+	for( int i = 0; i < N; i++ ) {
+		dummy( &mon1, &mon2 );
+	}
+	EndTime = Time();
+
+	sout | ( EndTime - StartTime ) / N | endl;
+}
Index: src/benchmark/SchedInt.c
===================================================================
--- src/benchmark/SchedInt.c	(revision c3528933d5f11e2e63ae14ac55903fbf6e42e2bd)
+++ src/benchmark/SchedInt.c	(revision c3528933d5f11e2e63ae14ac55903fbf6e42e2bd)
@@ -0,0 +1,83 @@
+#include <fstream>
+#include <stdlib>
+#include <thread>
+
+#include "bench.h"
+
+condition condA; 
+condition condB;
+condition condC;
+condition condD;
+
+monitor mon_t {};
+
+mon_t mon1, mon2;
+
+thread thrdA {};
+thread thrdB {};
+thread thrdC {};
+thread thrdD {};
+
+//-------------------------------------------------------------------
+// 1 monitor signal cycle
+void sideA( mon_t * mutex a ) {
+	long long int StartTime, EndTime;
+
+	StartTime = Time();
+	for( int i = 0;; i++ ) {
+		signal(&condA);
+		if( i > N ) break;
+		wait(&condB);
+	}
+	EndTime = Time();
+
+	sout | ( EndTime - StartTime ) / N;
+}
+
+void sideB( mon_t * mutex a ) {
+	for( int i = 0;; i++ ) {
+		signal(&condB);
+		if( i > N ) break;
+		wait(&condA);
+	}
+}
+
+//-------------------------------------------------------------------
+// 2 monitor signal cycle
+void sideC( mon_t * mutex a, mon_t * mutex b ) {
+	long long int StartTime, EndTime;
+
+	StartTime = Time();
+	for( int i = 0;; i++ ) {
+		signal(&condC);
+		if( i > N ) break;
+		wait(&condD);
+	}
+	EndTime = Time();
+
+	sout | ( EndTime - StartTime ) / N | endl;
+}
+
+void sideD( mon_t * mutex a, mon_t * mutex b ) {
+	for( int i = 0;; i++ ) {
+		signal(&condD);
+		if( i > N ) break;
+		wait(&condC);
+	}
+}
+
+void main( thrdA * this ) { sideA( &mon1 ); }
+void main( thrdB * this ) { sideB( &mon1 ); }
+void main( thrdC * this ) { sideC( &mon1, &mon2 ); }
+void main( thrdD * this ) { sideD( &mon1, &mon2 ); }
+
+int main() {
+	{
+		thrdA a;
+		thrdB b;
+	}
+	{
+		thrdC c;
+		thrdD d;
+	}
+}
Index: src/benchmark/ThrdCtxSwitch.c
===================================================================
--- src/benchmark/ThrdCtxSwitch.c	(revision f57668a590aa4cede590bc26725f85c38abb833a)
+++ src/benchmark/ThrdCtxSwitch.c	(revision c3528933d5f11e2e63ae14ac55903fbf6e42e2bd)
@@ -3,27 +3,5 @@
 #include <thread>
 
-#include <unistd.h>					// sysconf
-#include <sys/times.h>					// times
-#include <time.h>
-
-inline unsigned long long int Time() {
-    timespec ts;
-    clock_gettime(
-#if defined( __linux__ )
-	 CLOCK_THREAD_CPUTIME_ID,
-#elif defined( __freebsd__ )
-	 CLOCK_PROF,
-#elif defined( __solaris__ )
-	 CLOCK_HIGHRES,
-#else
-    #error uC++ : internal error, unsupported architecture
-#endif
-	 &ts );
-    return 1000000000LL * ts.tv_sec + ts.tv_nsec;
-} // Time
- 
-#ifndef N
-#define N 100000000
-#endif
+#include "bench.h"
 
 int main() {
Index: src/benchmark/bench.c
===================================================================
--- src/benchmark/bench.c	(revision f57668a590aa4cede590bc26725f85c38abb833a)
+++ src/benchmark/bench.c	(revision c3528933d5f11e2e63ae14ac55903fbf6e42e2bd)
@@ -4,23 +4,5 @@
 #include <thread>
 
-#include <unistd.h>					// sysconf
-#include <sys/times.h>					// times
-#include <time.h>
-
-inline unsigned long long int Time() {
-    timespec ts;
-    clock_gettime(
-#if defined( __linux__ )
-	 CLOCK_THREAD_CPUTIME_ID,
-#elif defined( __freebsd__ )
-	 CLOCK_PROF,
-#elif defined( __solaris__ )
-	 CLOCK_HIGHRES,
-#else
-    #error uC++ : internal error, unsupported architecture
-#endif
-	 &ts );
-    return 1000000000LL * ts.tv_sec + ts.tv_nsec;
-} // Time
+#include "bench.h"
 
 //=======================================
Index: src/benchmark/bench.h
===================================================================
--- src/benchmark/bench.h	(revision c3528933d5f11e2e63ae14ac55903fbf6e42e2bd)
+++ src/benchmark/bench.h	(revision c3528933d5f11e2e63ae14ac55903fbf6e42e2bd)
@@ -0,0 +1,27 @@
+#pragma once
+
+extern "C" {
+	#include <unistd.h>					// sysconf
+	#include <sys/times.h>					// times
+	#include <time.h>
+}
+
+inline unsigned long long int Time() {
+    timespec ts;
+    clock_gettime(
+#if defined( __linux__ )
+	 CLOCK_THREAD_CPUTIME_ID,
+#elif defined( __freebsd__ )
+	 CLOCK_PROF,
+#elif defined( __solaris__ )
+	 CLOCK_HIGHRES,
+#else
+    #error uC++ : internal error, unsupported architecture
+#endif
+	 &ts );
+    return 1000000000LL * ts.tv_sec + ts.tv_nsec;
+} // Time
+
+#ifndef N
+#define N 10000000
+#endif
Index: src/benchmark/csv-data.c
===================================================================
--- src/benchmark/csv-data.c	(revision f57668a590aa4cede590bc26725f85c38abb833a)
+++ src/benchmark/csv-data.c	(revision c3528933d5f11e2e63ae14ac55903fbf6e42e2bd)
@@ -1,27 +1,8 @@
 #include <fstream>
+#include <monitor>
 #include <stdlib>
 #include <thread>
 
-extern "C" {
-#include <unistd.h>					// sysconf
-#include <sys/times.h>					// times
-#include <time.h>
-}
-
-inline unsigned long long int Time() {
-    timespec ts;
-    clock_gettime(
-#if defined( __linux__ )
-	 CLOCK_THREAD_CPUTIME_ID,
-#elif defined( __freebsd__ )
-	 CLOCK_PROF,
-#elif defined( __solaris__ )
-	 CLOCK_HIGHRES,
-#else
-    #error uC++ : internal error, unsupported architecture
-#endif
-	 &ts );
-    return 1000000000LL * ts.tv_sec + ts.tv_nsec;
-} // Time
+#include "bench.h"
 
 coroutine GreatSuspender {};
@@ -48,6 +29,6 @@
 #endif
 
-
-
+//-----------------------------------------------------------------------------
+// coroutine context switch
 long long int measure_coroutine() {
 	const unsigned int NoOfTimes = N;
@@ -67,4 +48,6 @@
 }
 
+//-----------------------------------------------------------------------------
+// thread context switch
 long long int measure_thread() {
 	const unsigned int NoOfTimes = N;
@@ -80,6 +63,147 @@
 }
 
+//-----------------------------------------------------------------------------
+// single monitor entry
+monitor mon_t {};
+void dummy( mon_t * mutex m ) {}
+
+long long int measure_1_monitor_entry() {
+	const unsigned int NoOfTimes = N;
+	long long int StartTime, EndTime;
+	mon_t mon;
+
+	StartTime = Time();
+	for ( volatile unsigned int i = 0; i < NoOfTimes; i += 1 ) {
+		dummy( &mon );
+	}
+	EndTime = Time();
+
+	return ( EndTime - StartTime ) / NoOfTimes;
+}
+
+//-----------------------------------------------------------------------------
+// multi monitor entry
+void dummy( mon_t * mutex m1,  mon_t * mutex m2 ) {}
+
+long long int measure_2_monitor_entry() {
+	const unsigned int NoOfTimes = N;
+	long long int StartTime, EndTime;
+	mon_t mon1, mon2;
+
+	StartTime = Time();
+	for ( volatile unsigned int i = 0; i < NoOfTimes; i += 1 ) {
+		dummy( &mon1, &mon2 );
+	}
+	EndTime = Time();
+
+	return ( EndTime - StartTime ) / NoOfTimes;
+}
+
+//-----------------------------------------------------------------------------
+// single internal sched entry
+mon_t mon1;
+
+condition cond1a; 
+condition cond1b;
+
+thread thrd1a { long long int * out; };
+thread thrd1b {};
+
+void ?{}( thrd1a * this, long long int * out ) {
+	this->out = out;
+}
+
+void side1A( mon_t * mutex a, long long int * out ) {
+	long long int StartTime, EndTime;
+
+	StartTime = Time();
+	for( int i = 0;; i++ ) {
+		signal(&cond1a);
+		if( i > N ) break;
+		wait(&cond1b);
+	}
+	EndTime = Time();
+
+	*out = ( EndTime - StartTime ) / N;
+}
+
+void side1B( mon_t * mutex a ) {
+	for( int i = 0;; i++ ) {
+		signal(&cond1b);
+		if( i > N ) break;
+		wait(&cond1a);
+	}
+}
+
+void main( thrd1a * this ) { side1A( &mon1, this->out ); }
+void main( thrd1b * this ) { side1B( &mon1 ); }
+
+long long int measure_1_sched_int() {
+	long long int t;
+	{
+		thrd1a a = { &t };
+		thrd1b b;
+	}
+	return t;
+}
+
+//-----------------------------------------------------------------------------
+// multi internal sched entry
+mon_t mon2;
+
+condition cond2a; 
+condition cond2b;
+
+thread thrd2a { long long int * out; };
+thread thrd2b {};
+
+void ?{}( thrd2a * this, long long int * out ) {
+	this->out = out;
+}
+
+void side2A( mon_t * mutex a, mon_t * mutex b, long long int * out ) {
+	long long int StartTime, EndTime;
+
+	StartTime = Time();
+	for( int i = 0;; i++ ) {
+		signal(&cond2a);
+		if( i > N ) break;
+		wait(&cond2b);
+	}
+	EndTime = Time();
+
+	*out = ( EndTime - StartTime ) / N;
+}
+
+void side2B( mon_t * mutex a, mon_t * mutex b ) {
+	for( int i = 0;; i++ ) {
+		signal(&cond2b);
+		if( i > N ) break;
+		wait(&cond2a);
+	}
+}
+
+void main( thrd2a * this ) { side2A( &mon1, &mon2, this->out ); }
+void main( thrd2b * this ) { side2B( &mon1, &mon2 ); }
+
+long long int measure_2_sched_int() {
+	long long int t;
+	{
+		thrd2a a = { &t };
+		thrd2b b;
+	}
+	return t;
+}
+
+//-----------------------------------------------------------------------------
+// main loop
 int main()
 {
-	sout | time(NULL) | ',' | measure_coroutine() | ',' | measure_thread() | endl;
-}
+	sout | time(NULL) | ',';
+	sout | measure_coroutine() | ',';
+	sout | measure_thread() | ',';
+	sout | measure_1_monitor_entry() | ',';
+	sout | measure_2_monitor_entry() | ',';
+	sout | measure_1_sched_int() | ',';
+	sout | measure_2_sched_int() | endl;
+}
Index: src/libcfa/concurrency/thread.c
===================================================================
--- src/libcfa/concurrency/thread.c	(revision f57668a590aa4cede590bc26725f85c38abb833a)
+++ src/libcfa/concurrency/thread.c	(revision c3528933d5f11e2e63ae14ac55903fbf6e42e2bd)
@@ -40,6 +40,6 @@
 	this->next = NULL;
 
-	this->current_monitors      = NULL;
-	this->current_monitor_count = 0;
+	this->current_monitors      = &this->mon;
+	this->current_monitor_count = 1;
 }
 
Index: src/tests/.expect/concurrent/sched-int-barge.txt
===================================================================
--- src/tests/.expect/concurrent/sched-int-barge.txt	(revision c3528933d5f11e2e63ae14ac55903fbf6e42e2bd)
+++ src/tests/.expect/concurrent/sched-int-barge.txt	(revision c3528933d5f11e2e63ae14ac55903fbf6e42e2bd)
@@ -0,0 +1,100 @@
+1000
+2000
+3000
+4000
+5000
+6000
+7000
+8000
+9000
+10000
+11000
+12000
+13000
+14000
+15000
+16000
+17000
+18000
+19000
+20000
+21000
+22000
+23000
+24000
+25000
+26000
+27000
+28000
+29000
+30000
+31000
+32000
+33000
+34000
+35000
+36000
+37000
+38000
+39000
+40000
+41000
+42000
+43000
+44000
+45000
+46000
+47000
+48000
+49000
+50000
+51000
+52000
+53000
+54000
+55000
+56000
+57000
+58000
+59000
+60000
+61000
+62000
+63000
+64000
+65000
+66000
+67000
+68000
+69000
+70000
+71000
+72000
+73000
+74000
+75000
+76000
+77000
+78000
+79000
+80000
+81000
+82000
+83000
+84000
+85000
+86000
+87000
+88000
+89000
+90000
+91000
+92000
+93000
+94000
+95000
+96000
+97000
+98000
+99000
+100000
Index: src/tests/.expect/concurrent/sched-int-disjoint.txt
===================================================================
--- src/tests/.expect/concurrent/sched-int-disjoint.txt	(revision c3528933d5f11e2e63ae14ac55903fbf6e42e2bd)
+++ src/tests/.expect/concurrent/sched-int-disjoint.txt	(revision c3528933d5f11e2e63ae14ac55903fbf6e42e2bd)
@@ -0,0 +1,101 @@
+1000
+2000
+3000
+4000
+5000
+6000
+7000
+8000
+9000
+10000
+11000
+12000
+13000
+14000
+15000
+16000
+17000
+18000
+19000
+20000
+21000
+22000
+23000
+24000
+25000
+26000
+27000
+28000
+29000
+30000
+31000
+32000
+33000
+34000
+35000
+36000
+37000
+38000
+39000
+40000
+41000
+42000
+43000
+44000
+45000
+46000
+47000
+48000
+49000
+50000
+51000
+52000
+53000
+54000
+55000
+56000
+57000
+58000
+59000
+60000
+61000
+62000
+63000
+64000
+65000
+66000
+67000
+68000
+69000
+70000
+71000
+72000
+73000
+74000
+75000
+76000
+77000
+78000
+79000
+80000
+81000
+82000
+83000
+84000
+85000
+86000
+87000
+88000
+89000
+90000
+91000
+92000
+93000
+94000
+95000
+96000
+97000
+98000
+99000
+100000
+All waiter done
Index: c/tests/.expect/concurrent/sched-int-multi.txt
===================================================================
--- src/tests/.expect/concurrent/sched-int-multi.txt	(revision f57668a590aa4cede590bc26725f85c38abb833a)
+++ 	(revision )
@@ -1,100 +1,0 @@
-1000
-2000
-3000
-4000
-5000
-6000
-7000
-8000
-9000
-10000
-11000
-12000
-13000
-14000
-15000
-16000
-17000
-18000
-19000
-20000
-21000
-22000
-23000
-24000
-25000
-26000
-27000
-28000
-29000
-30000
-31000
-32000
-33000
-34000
-35000
-36000
-37000
-38000
-39000
-40000
-41000
-42000
-43000
-44000
-45000
-46000
-47000
-48000
-49000
-50000
-51000
-52000
-53000
-54000
-55000
-56000
-57000
-58000
-59000
-60000
-61000
-62000
-63000
-64000
-65000
-66000
-67000
-68000
-69000
-70000
-71000
-72000
-73000
-74000
-75000
-76000
-77000
-78000
-79000
-80000
-81000
-82000
-83000
-84000
-85000
-86000
-87000
-88000
-89000
-90000
-91000
-92000
-93000
-94000
-95000
-96000
-97000
-98000
-99000
-100000
Index: c/tests/.expect/concurrent/sched-int-multi2.txt
===================================================================
--- src/tests/.expect/concurrent/sched-int-multi2.txt	(revision f57668a590aa4cede590bc26725f85c38abb833a)
+++ 	(revision )
@@ -1,12 +1,0 @@
-Waiting 1
-Waiting 2
-Waiting 3
-Waiting 4
-Signaling ABC
-Signaling AB
-Signaling BC
-Signaling AC
-Waking 4
-Waking 3
-Waking 2
-Waking 1
Index: c/tests/.expect/concurrent/sched-int.txt
===================================================================
--- src/tests/.expect/concurrent/sched-int.txt	(revision f57668a590aa4cede590bc26725f85c38abb833a)
+++ 	(revision )
@@ -1,3 +1,0 @@
-Step 1
-Step 2
-Step 3
Index: src/tests/Makefile.am
===================================================================
--- src/tests/Makefile.am	(revision f57668a590aa4cede590bc26725f85c38abb833a)
+++ src/tests/Makefile.am	(revision c3528933d5f11e2e63ae14ac55903fbf6e42e2bd)
@@ -22,5 +22,5 @@
 concurrent=yes
 quick_test+= coroutine thread monitor
-concurrent_test=coroutine thread monitor multi-monitor sched-int sched-int-multi sched-int-multi2 sched-ext sched-ext-multi preempt
+concurrent_test=coroutine thread monitor multi-monitor sched-int-disjoint sched-int-barge sched-int-wait sched-ext sched-ext-multi preempt
 else
 concurrent=no
Index: src/tests/Makefile.in
===================================================================
--- src/tests/Makefile.in	(revision f57668a590aa4cede590bc26725f85c38abb833a)
+++ src/tests/Makefile.in	(revision c3528933d5f11e2e63ae14ac55903fbf6e42e2bd)
@@ -230,5 +230,5 @@
 @BUILD_CONCURRENCY_TRUE@concurrent = yes
 @BUILD_CONCURRENCY_FALSE@concurrent_test = 
-@BUILD_CONCURRENCY_TRUE@concurrent_test = coroutine thread monitor multi-monitor sched-int sched-int-multi sched-int-multi2 sched-ext sched-ext-multi preempt
+@BUILD_CONCURRENCY_TRUE@concurrent_test = coroutine thread monitor multi-monitor sched-int-disjoint sched-int-barge sched-int-wait sched-ext sched-ext-multi preempt
 
 # applies to both programs
Index: src/tests/sched-int-barge.c
===================================================================
--- src/tests/sched-int-barge.c	(revision c3528933d5f11e2e63ae14ac55903fbf6e42e2bd)
+++ src/tests/sched-int-barge.c	(revision c3528933d5f11e2e63ae14ac55903fbf6e42e2bd)
@@ -0,0 +1,97 @@
+#include <fstream>
+#include <kernel>
+#include <monitor>
+#include <stdlib>
+#include <thread>
+
+enum state_t { WAIT, SIGNAL, BARGE };
+
+monitor global_t {};
+
+monitor global_data_t {
+	bool done;
+	int counter;
+	state_t state;
+
+	unsigned short do_signal;
+	unsigned short do_wait2;
+	unsigned short do_wait1;
+};
+
+void ?{} ( global_data_t * this ) {
+	this->done = false;
+	this->counter = 0;
+	this->state = BARGE;
+
+	this->do_signal = 6;
+	this->do_wait1  = 1;
+	this->do_wait2  = 3;
+}
+
+void ^?{} ( global_data_t * this ) {}
+
+global_t globalA;
+global_t globalB;
+global_data_t globalC;
+
+condition cond;
+
+thread Threads {};
+
+bool logicC( global_t * mutex a, global_t * mutex b, global_data_t * mutex c ) {
+	c->counter++;
+
+	if( (c->counter % 1000) == 0 ) sout | c->counter | endl;
+
+	int action = c->counter % 10;
+
+	if( action == 0 ) {
+		c->do_signal = max( ((unsigned)rand48()) % 10, 1);
+		c->do_wait1 = ((unsigned)rand48()) % (c->do_signal);
+		c->do_wait2 = ((unsigned)rand48()) % (c->do_signal);
+
+		// if(c->do_wait1 == c->do_wait2) sout | "Same" | endl;
+	}
+
+	if( action == c->do_wait1 || action == c->do_wait2 ) {
+		c->state = WAIT;
+		wait( &cond );
+
+		if(c->state != SIGNAL) {
+			sout | "ERROR Barging detected" | c->counter | endl;
+			abort();
+		}
+	}
+	else if( action == c->do_signal ) {
+		c->state = SIGNAL;
+
+		signal( &cond );
+		signal( &cond );
+	}
+	else {
+		c->state = BARGE;
+	}
+
+	if( c->counter >= 100_000 ) c->done = true;
+	return !c->done;
+}
+
+bool logicB( global_t * mutex a, global_t * mutex b ) {
+	return logicC(a, b, &globalC);
+}
+
+bool logicA( global_t * mutex a ) {
+	return logicB(a, &globalB);
+}
+
+void main( Threads* this ) {
+	while( logicA(&globalA) ) { yield(); };
+}
+
+int main(int argc, char* argv[]) {
+	rand48seed(0);
+	processor p;
+	{
+		Threads t[17];
+	}
+}
Index: src/tests/sched-int-disjoint.c
===================================================================
--- src/tests/sched-int-disjoint.c	(revision c3528933d5f11e2e63ae14ac55903fbf6e42e2bd)
+++ src/tests/sched-int-disjoint.c	(revision c3528933d5f11e2e63ae14ac55903fbf6e42e2bd)
@@ -0,0 +1,115 @@
+#include <fstream>
+#include <kernel>
+#include <monitor>
+#include <thread>
+
+#define N 100_000
+
+enum state_t { WAIT, SIGNAL, BARGE };
+
+monitor global_t {};
+global_t mut;
+
+monitor global_data_t;
+void ?{}( global_data_t * this );
+void ^?{} ( global_data_t * this );
+
+monitor global_data_t {
+	int counter;
+	state_t state;
+} data;
+
+condition cond;
+
+volatile bool all_done;
+
+void ?{}( global_data_t * this ) {
+	this->counter == 0;
+	this->state = BARGE;
+}
+
+void ^?{} ( global_data_t * this ) {}
+
+//------------------------------------------------------------------------------
+// Barging logic
+void barge( global_data_t * mutex d ) {
+	d->state = BARGE;
+}
+
+thread Barger {};
+
+void main( Barger * this ) {
+	while( !all_done ) { 
+		barge( &data );
+		yield(); 
+	}
+}
+
+//------------------------------------------------------------------------------
+// Waiting logic
+bool wait( global_t * mutex m, global_data_t * mutex d ) {
+	wait( &cond );
+	if( d->state != SIGNAL ) {
+		sout | "ERROR barging!" | endl; 
+	}
+
+	d->counter++;
+
+	if( (d->counter % 1000) == 0 ) sout | d->counter | endl;
+
+	return d->counter < N;
+}
+
+thread Waiter {};
+
+void main( Waiter * this ) {
+	while( wait( &mut, &data ) ) { yield(); }
+}
+
+
+//------------------------------------------------------------------------------
+// Signalling logic
+void signal( condition * cond, global_t * mutex a, global_data_t * mutex b ) {
+	b->state = SIGNAL;
+	signal( cond );
+}
+
+void logic( global_t * mutex a ) {
+	signal( &cond, a, &data );
+
+	int pauses = (unsigned)rand48() % 10;
+	for(int i = 0; i < pauses; i++) {
+		yield();
+	}
+
+	//This is technically a mutual exclusion violation but the mutex monitor protects us
+	bool running = data.counter < N && data.counter > 0;
+	if( data.state != SIGNAL && running ) {
+		sout | "ERROR Eager signal" | data.state | endl; 
+	}
+}
+
+thread Signaller {};
+
+void main( Signaller * this ) {
+	while( !all_done ) { 
+		logic( &mut );
+		yield(); 
+	}
+}
+
+//------------------------------------------------------------------------------
+// Main loop
+int main(int argc, char* argv[]) {
+	all_done = false;
+	processor p;
+	{
+		Signaller s;
+		Barger b[17];
+		{
+			Waiter w[4];
+		}
+		sout | "All waiter done" | endl;
+		all_done = true;
+	}	
+}
Index: c/tests/sched-int-multi.c
===================================================================
--- src/tests/sched-int-multi.c	(revision f57668a590aa4cede590bc26725f85c38abb833a)
+++ 	(revision )
@@ -1,88 +1,0 @@
-#include <fstream>
-#include <kernel>
-#include <monitor>
-#include <thread>
-
-enum state_t { WAIT, SIGNAL, BARGE };
-
-monitor global_t {};
-
-monitor global_data_t {
-	bool done;
-	int counter;
-	state_t state;
-};
-
-void ?{} ( global_data_t * this ) {
-	this->done = false;
-	this->counter = 0;
-	this->state = BARGE;
-}
-
-void ^?{} ( global_data_t * this ) {}
-
-global_t globalA;
-global_t globalB;
-global_data_t globalC;
-
-condition cond;
-
-thread Threads {};
-
-bool logicC( global_t * mutex a, global_t * mutex b, global_data_t * mutex c ) {
-	c->counter++;
-
-	int action = c->counter % 10;
-
-	if( action == 1 || action == 3 ) {
-		if(c->state != BARGE) {
-			sout | "ERROR Mutual exclusion is inconsistent for wait" | endl;
-			abort();
-		}
-
-		c->state = WAIT;
-		wait( &cond );
-
-		if(c->state != SIGNAL) {
-			sout | "ERROR Barging detected" | endl;
-			abort();
-		}
-	}
-	else if( action == 6 ) {
-		if(c->state != BARGE) {
-			sout | "ERROR Mutual exclusion is inconsistent for signal" | endl;
-			abort();
-		}
-
-		c->state = SIGNAL;
-
-		signal( &cond );
-		signal( &cond );
-	}
-	else {
-		c->state = BARGE;
-	}
-
-	if( (c->counter % 1000) == 0 ) sout | c->counter | endl;
-	if( c->counter == 100_000 ) c->done = true;
-	return !c->done;
-}
-
-bool logicB( global_t * mutex a, global_t * mutex b ) {
-	return logicC(a, b, &globalC);
-}
-
-bool logicA( global_t * mutex a ) {
-	return logicB(a, &globalB);
-}
-
-void main( Threads* this ) {
-	while( logicA(&globalA) ) { yield(); };
-}
-
-int main(int argc, char* argv[]) {
-	processor p[3];
-	{
-		Threads t[20];
-	}
-}
Index: c/tests/sched-int-multi2.c
===================================================================
--- src/tests/sched-int-multi2.c	(revision f57668a590aa4cede590bc26725f85c38abb833a)
+++ 	(revision )
@@ -1,119 +1,0 @@
-#include <fstream>
-#include <kernel>
-#include <monitor>
-#include <thread>
-
-monitor global_t {};
-
-global_t globalA;
-global_t globalB;
-global_t globalC;
-
-condition condAB, condAC, condBC, condABC;
-
-thread Signaler {};
-thread WaiterAB {};
-thread WaiterAC {};
-thread WaiterBC {};
-thread WaiterABC{};
-
-int state;
-
-/*
-multi phase
-*/
-
-//----------------------------------------------------------------------------------------------------
-// Tools
-void signal( condition * cond, global_t * mutex a, global_t * mutex b ) {
-	signal( cond );
-}
-
-void signal( condition * cond, global_t * mutex a, global_t * mutex b, global_t * mutex c ) {
-	signal( cond );
-}
-
-void wait( condition * cond, global_t * mutex a, global_t * mutex b ) {
-	state++;
-	sout | "Waiting" | state | endl;
-	wait( cond );
-	sout | "Waking" | state | endl;
-	state--;
-}
-
-void wait( condition * cond, global_t * mutex a, global_t * mutex b, global_t * mutex c ) {
-	state++;
-	sout | "Waiting" | state | endl;
-	wait( cond );
-	sout | "Waking" | state | endl;
-	state--;
-}
-
-//----------------------------------------------------------------------------------------------------
-// Signaler
-// signals respectively AB, AC, BC, ABC
-void signalerABC( global_t * mutex a, global_t * mutex b, global_t * mutex c ) {
-	sout | "Signaling ABC" | endl;
-	signal( &condABC, a, b, c );
-	sout | "Signaling AB" | endl;
-	signal( &condAB , a, b );
-	sout | "Signaling BC" | endl;
-	signal( &condBC , b, c );
-	sout | "Signaling AC" | endl;
-	signal( &condAC , a, c );
-}
-
-void signalerAB( global_t * mutex a, global_t * mutex b, global_t * c ) {
-	signalerABC(a, b, c);
-}
-
-void signalerA( global_t * mutex a, global_t * b, global_t * c ) {
-	signalerAB (a, b, c);
-}
-
-void main( Signaler* this ) {
-	while( state != 4 ) { yield(); }
-	signalerA( &globalA, &globalB, &globalC );
-}
-
-//----------------------------------------------------------------------------------------------------
-// Waiter ABC
-void main( WaiterABC* this ) {
-	while( state != 0 ) { yield(); }
-	wait( &condABC, &globalA, &globalB, &globalC );
-}
-
-//----------------------------------------------------------------------------------------------------
-// Waiter AB
-void main( WaiterAB* this ) {
-	while( state != 1 ) { yield(); }
-	wait( &condAB , &globalA, &globalB );
-}
-
-//----------------------------------------------------------------------------------------------------
-// Waiter AC
-void main( WaiterAC* this ) {
-	while( state != 2 ) { yield(); }
-	wait( &condAC , &globalA, &globalC );
-}
-
-//----------------------------------------------------------------------------------------------------
-// Waiter BC
-void main( WaiterBC* this ) {
-	while( state != 3 ) { yield(); }
-	wait( &condBC , &globalB, &globalC );
-}
-
-//----------------------------------------------------------------------------------------------------
-// Main
-int main(int argc, char* argv[]) {
-	state = 0;
-	processor p;
-	{
-		WaiterABC a;
-		WaiterAB  b;
-		WaiterBC  c;
-		WaiterAC  d;
-		Signaler  e;
-	}
-}
Index: src/tests/sched-int-wait.c
===================================================================
--- src/tests/sched-int-wait.c	(revision c3528933d5f11e2e63ae14ac55903fbf6e42e2bd)
+++ src/tests/sched-int-wait.c	(revision c3528933d5f11e2e63ae14ac55903fbf6e42e2bd)
@@ -0,0 +1,145 @@
+#include <fstream>
+#include <kernel>
+#include <monitor>
+#include <stdlib>
+#include <thread>
+
+monitor global_t {};
+
+global_t globalA;
+global_t globalB;
+global_t globalC;
+
+condition condAB, condAC, condBC, condABC;
+
+thread Signaler {
+	int signals[4];
+};
+
+void ?{}( Signaler * this ){
+	this->signals[0] = 0;
+	this->signals[1] = 0;
+	this->signals[2] = 0;
+	this->signals[3] = 0;
+}
+
+thread WaiterAB {};
+thread WaiterAC {};
+thread WaiterBC {};
+thread WaiterABC{};
+
+volatile bool done;
+
+//----------------------------------------------------------------------------------------------------
+// Tools
+void signal( condition * cond, global_t * mutex a, global_t * mutex b ) {
+	signal( cond );
+}
+
+void signal( condition * cond, global_t * mutex a, global_t * mutex b, global_t * mutex c ) {
+	signal( cond );
+}
+
+void wait( condition * cond, global_t * mutex a, global_t * mutex b ) {
+	wait( cond );
+}
+
+void wait( condition * cond, global_t * mutex a, global_t * mutex b, global_t * mutex c ) {
+	wait( cond );
+}
+
+//----------------------------------------------------------------------------------------------------
+// Signaler
+void main( Signaler* this ) {
+
+	while( true ) {
+		int action = (unsigned)rand48() % 4;
+		bool finished = true;
+
+		for(int i = 0; i < 4; i++) {
+			if( this->signals[action] < 10_000 ) {
+				finished = false;
+				break;
+			}
+			else {
+				action = (action + 1) % 4;
+			}
+		}
+
+		this->signals[action]++;
+		if( finished ) break;
+
+		//sout | action | this->signals[0] | this->signals[1] | this->signals[2] | this->signals[3] | endl;
+
+		switch( action ) {
+			case 0: 
+				signal( &condABC, &globalA, &globalB, &globalC );
+				break;
+			case 1: 
+				signal( &condAB , &globalA, &globalB );
+				break;
+			case 2: 
+				signal( &condBC , &globalB, &globalC );
+				break;
+			case 3: 
+				signal( &condAC , &globalA, &globalC );
+				break;
+			default:
+				sout | "Something went wrong" | endl;
+				abort();
+		}
+	}	
+}
+
+//----------------------------------------------------------------------------------------------------
+// Waiter ABC
+void main( WaiterABC* this ) {
+	while( !done ) {
+		wait( &condABC, &globalA, &globalB, &globalC );
+	}
+}
+
+//----------------------------------------------------------------------------------------------------
+// Waiter AB
+void main( WaiterAB* this ) {
+	while( !done ) {
+		wait( &condAB , &globalA, &globalB );
+	}
+}
+
+//----------------------------------------------------------------------------------------------------
+// Waiter AC
+void main( WaiterAC* this ) {
+	while( !done ) {
+		wait( &condAC , &globalA, &globalC );
+	}
+}
+
+//----------------------------------------------------------------------------------------------------
+// Waiter BC
+void main( WaiterBC* this ) {
+	while( !done ) {
+		wait( &condBC , &globalB, &globalC );
+	}
+}
+
+//----------------------------------------------------------------------------------------------------
+// Main
+int main(int argc, char* argv[]) {
+	done = false;
+	processor p;
+	{
+		WaiterABC a;
+		WaiterAB  b;
+		WaiterBC  c;
+		WaiterAC  d;
+		{
+			Signaler  e;
+		}
+		done = true;
+		signal( &condABC, &globalA, &globalB, &globalC );
+		signal( &condAB , &globalA, &globalB );
+		signal( &condBC , &globalB, &globalC );
+		signal( &condAC , &globalA, &globalC );
+	}
+}
Index: c/tests/sched-int.c
===================================================================
--- src/tests/sched-int.c	(revision f57668a590aa4cede590bc26725f85c38abb833a)
+++ 	(revision )
@@ -1,60 +1,0 @@
-#include <fstream>
-#include <kernel>
-#include <monitor>
-#include <thread>
-
-monitor global_t {
-	int value;
-};
-
-global_t global;
-
-condition cond;
-
-thread Signalee {};
-thread Signaler {};
-
-void step1( global_t * mutex this ) {
-	sout | "Step 1" | endl;
-	this->value = 1;
-	wait( &cond );
-}
-
-void step2( global_t * mutex this ) {
-	if( this->value != 1) abort();
-
-	sout | "Step 2" | endl;
-	this->value = 2;
-	signal( &cond );
-}
-
-void step3( global_t * mutex this ) {
-	if( this->value != 2) abort();
-
-	sout | "Step 3" | endl;
-	this->value = 3;
-	signal( &cond );
-}
-
-void main( Signalee* this ) {
-	step1( &global );
-	step3( &global );
-}
-
-void main( Signaler* this ) {
-	for(int i = 0; i < 10_000; i++) {
-		asm volatile ("" : : : "memory");
-	}
-
-	step2( &global );
-}
-
-int main(int argc, char* argv[]) {
-	assert( global.__mon.entry_queue.tail != NULL );
-	processor p;
-	{
-		Signalee a;
-		Signaler b;
-	}
-	if( global.value != 3) abort();
-}
