Index: Jenkins/FullBuild
===================================================================
--- Jenkins/FullBuild	(revision bf4ac097c572e75965508a6487a639abaf9d6cc9)
+++ Jenkins/FullBuild	(revision f2e40a9f50860a5c9c4447c43e425d72254dcf7d)
@@ -20,12 +20,12 @@
 
 					parallel (
-						gcc_6_x64: { trigger_build( 'gcc-6',   'x64' ) },
-						gcc_6_x86: { trigger_build( 'gcc-6',   'x86' ) },
-						gcc_5_x64: { trigger_build( 'gcc-5',   'x64' ) },
-						gcc_5_x86: { trigger_build( 'gcc-5',   'x86' ) },
-						gcc_4_x64: { trigger_build( 'gcc-4.9', 'x64' ) },
-						gcc_4_x86: { trigger_build( 'gcc-4.9', 'x86' ) },
-						clang_x64: { trigger_build( 'clang',   'x64' ) },
-						clang_x86: { trigger_build( 'clang',   'x86' ) },
+						gcc_6_x64: { trigger_build( 'gcc-6',   'x64', true  ) },
+						gcc_6_x86: { trigger_build( 'gcc-6',   'x86', true  ) },
+						gcc_5_x64: { trigger_build( 'gcc-5',   'x64', false ) },
+						gcc_5_x86: { trigger_build( 'gcc-5',   'x86', false ) },
+						gcc_4_x64: { trigger_build( 'gcc-4.9', 'x64', false ) },
+						gcc_4_x86: { trigger_build( 'gcc-4.9', 'x86', false ) },
+						clang_x64: { trigger_build( 'clang',   'x64', false ) },
+						clang_x86: { trigger_build( 'clang',   'x86', false ) },
 					)
 
@@ -62,5 +62,5 @@
 //===========================================================================================================
 
-def trigger_build(String cc, String arch) {
+def trigger_build(String cc, String arch, Boolean publish) {
 	def result = build job: 'Cforall/master', 		\
 		parameters: [						\
@@ -82,5 +82,5 @@
 			[$class: 'BooleanParameterValue', 		\
 			  name: 'pPublish', 				\
-			  value: true], 					\
+			  value: publish], 					\
 			[$class: 'BooleanParameterValue', 		\
 			  name: 'pSilent', 				\
Index: Jenkinsfile
===================================================================
--- Jenkinsfile	(revision bf4ac097c572e75965508a6487a639abaf9d6cc9)
+++ Jenkinsfile	(revision f2e40a9f50860a5c9c4447c43e425d72254dcf7d)
@@ -131,5 +131,5 @@
 				[$class: 'BooleanParameterDefinition',  						\
 					description: 'If true, jenkins also builds documentation', 		\
-					name: 'pBuildDocumentation', 								\
+					name: 'pBuildDocumentation', 							\
 					defaultValue: true,  								\
 				],												\
@@ -137,9 +137,9 @@
 					description: 'If true, jenkins also publishes results', 		\
 					name: 'pPublish', 								\
-					defaultValue: true,  								\
+					defaultValue: false,  								\
 				],												\
 				[$class: 'BooleanParameterDefinition',  						\
 					description: 'If true, jenkins will not send emails', 		\
-					name: 'pSilent', 						\
+					name: 'pSilent', 									\
 					defaultValue: false,  								\
 				],												\
@@ -159,5 +159,5 @@
 	echo """Compiler 		: ${compiler.cc_name} (${compiler.cpp_cc}/${compiler.cfa_cc})
 Architecture		: ${arch_name}
-Arc Flags			: ${architecture}
+Arc Flags		: ${architecture}
 Run All Tests		: ${ pRunAllTests.toString() }
 Run Benchmark		: ${ pRunBenchmark.toString() }
Index: doc/proposals/concurrency/thePlan.md
===================================================================
--- doc/proposals/concurrency/thePlan.md	(revision bf4ac097c572e75965508a6487a639abaf9d6cc9)
+++ doc/proposals/concurrency/thePlan.md	(revision f2e40a9f50860a5c9c4447c43e425d72254dcf7d)
@@ -7,5 +7,5 @@
 
 _Phase 2_ : Minimum Viable Product
-Monitor type and enter/leave mutex member routines
+done - Monitor type and enter/leave mutex member routines
 Monitors as a language feature (not calling enter/leave by hand)
 Internal scheduling
Index: doc/proposals/flags.md
===================================================================
--- doc/proposals/flags.md	(revision bf4ac097c572e75965508a6487a639abaf9d6cc9)
+++ doc/proposals/flags.md	(revision f2e40a9f50860a5c9c4447c43e425d72254dcf7d)
@@ -69,4 +69,29 @@
 In each of the cases above, `FOO` could be replaced by `(BAR | BAZ)` to do the same operation or test on multiple flags at once.
 
+### Alternative/Additional Features ###
+
+#### User-defined enum discriminant iterator ####
+It may be useful to provide a more general method for changing the enum discriminant assignment function, e.g. the flag enum discriminants could be defined by something like the following:
+
+	```
+	enum(@ << 1) TCP_Flags {  // each discriminant is left-shifted by 1 from the previous
+		FIN = 0x1,  // first flag is 1
+		SYN,
+		ACK,
+		...
+	}
+	```
+
+#### Member expression for enums ####
+As a more ergonomic way to set and unset enum flags, we could define a member expression for flags enums. Since only unions and structs can have member expressions now, this change would be backwards compatible. Basically, given a `FunFlags f`, `f.FOO` would return a proxy object which could be implicitly converted to `bool` (with semantics `f & FOO`, i.e. "check if `FOO` is set on `f`"), as well as having `bool` assigned to it (with semantics `f |= FOO` on true or `f -= FOO` on false, i.e. "set or unset `FOO` on `f` as appropriate"). With this member function, the operations above can be expressed as follows (possibly more ergonomically):
+
+	```
+	FunFlags f = some_val();
+	if ( f.FOO ) { sout | "f has FOO set" | endl; }
+	f.FOO = true;    // set FOO
+	f.FOO = false;   // unset FOO
+	f.FOO = ! f.FOO; // toggle FOO
+	```
+
 ### Related Work ###
 C# has the [`[Flags]`][1] enum attribute, but their proposal does not go as far; specifically, the flag discriminants must be manually specified, and they do not automatically implement the bitwise operators on the flags. 
Index: src/Concurrency/Keywords.cc
===================================================================
--- src/Concurrency/Keywords.cc	(revision bf4ac097c572e75965508a6487a639abaf9d6cc9)
+++ src/Concurrency/Keywords.cc	(revision f2e40a9f50860a5c9c4447c43e425d72254dcf7d)
@@ -88,5 +88,5 @@
 	//Handles mutex routines definitions :
 	// void foo( A * mutex a, B * mutex b,  int i ) {                  void foo( A * a, B * b,  int i ) {
-	// 	                                                                 monitor_desc * __monitors[] = { a, b };
+	// 	                                                                 monitor_desc * __monitors[] = { get_monitor(a), get_monitor(b) };
 	// 	                                                                 monitor_guard_t __guard = { __monitors, 2 };
 	//    /*Some code*/                                       =>           /*Some code*/
@@ -98,4 +98,5 @@
 		using Visitor::visit;
 		virtual void visit( FunctionDecl *functionDecl ) override final;
+		virtual void visit(   StructDecl *functionDecl ) override final;
 
 		std::list<DeclarationWithType*> findMutexArgs( FunctionDecl* );
@@ -107,4 +108,7 @@
 			acceptAll( translationUnit, impl );
 		}
+
+	  private:
+	  	StructDecl* monitor_decl = nullptr;
 	};
 
@@ -133,5 +137,13 @@
 		if( ! body ) return;
 
+		assert(monitor_decl);
 		addStatments( body, mutexArgs );
+	}
+
+	void MutexKeyword::visit(StructDecl* decl) {
+		if( decl->get_name() == "monitor_desc" ) {
+			assert( !monitor_decl );
+			monitor_decl = decl;
+		}
 	}
 
@@ -167,4 +179,33 @@
 
 	void MutexKeyword::addStatments( CompoundStmt * body, const std::list<DeclarationWithType * > & args ) {
+
+		ObjectDecl * monitors = new ObjectDecl(
+			"__monitors",
+			noStorage,
+			LinkageSpec::Cforall,
+			nullptr,
+			new ArrayType(
+				noQualifiers,
+				new PointerType(
+					noQualifiers,
+					new StructInstType(
+						noQualifiers,
+						monitor_decl
+					)
+				),
+				new ConstantExpr( Constant::from_ulong( args.size() ) ),
+				false,
+				false
+			),
+			new ListInit(
+				map_range < std::list<Initializer*> > ( args, [](DeclarationWithType * var ){
+					return new SingleInit( new UntypedExpr(
+						new NameExpr( "get_monitor" ),
+						{  new VariableExpr( var ) }
+					) );
+				})
+			)
+		);
+
 		//in reverse order :
 		// monitor_guard_t __guard = { __monitors, # };
@@ -181,5 +222,5 @@
 				new ListInit(
 					{
-						new SingleInit( new NameExpr( "__monitors" ) ),
+						new SingleInit( new VariableExpr( monitors ) ),
 						new SingleInit( new ConstantExpr( Constant::from_ulong( args.size() ) ) )
 					}
@@ -189,30 +230,5 @@
 
 		//monitor_desc * __monitors[] = { a, b };
-		body->push_front(
-			new DeclStmt( noLabels, new ObjectDecl(
-				"__monitors",
-				noStorage,
-				LinkageSpec::Cforall,
-				nullptr,
-				new ArrayType(
-					noQualifiers,
-					new PointerType(
-						noQualifiers,
-						new StructInstType(
-							noQualifiers,
-							"monitor_desc"
-						)
-					),
-					new ConstantExpr( Constant::from_ulong( args.size() ) ),
-					false,
-					false
-				),
-				new ListInit(
-					map_range < std::list<Initializer*> > ( args, [](DeclarationWithType * var ){
-						return new SingleInit( new VariableExpr( var ) );
-					})
-				)
-			))
-		);
+		body->push_front( new DeclStmt( noLabels, monitors) );
 	}
 };
Index: src/GenPoly/Box.cc
===================================================================
--- src/GenPoly/Box.cc	(revision bf4ac097c572e75965508a6487a639abaf9d6cc9)
+++ src/GenPoly/Box.cc	(revision f2e40a9f50860a5c9c4447c43e425d72254dcf7d)
@@ -381,5 +381,5 @@
 		// calculate struct layout in function body
 
-		// initialize size and alignment to 0 and 1 (will have at least one member to re-edit size
+		// initialize size and alignment to 0 and 1 (will have at least one member to re-edit size)
 		addExpr( layoutDecl->get_statements(), makeOp( "?=?", derefVar( sizeParam ), new ConstantExpr( Constant( sizeAlignType->clone(), "0" ) ) ) );
 		addExpr( layoutDecl->get_statements(), makeOp( "?=?", derefVar( alignParam ), new ConstantExpr( Constant( sizeAlignType->clone(), "1" ) ) ) );
@@ -1852,5 +1852,6 @@
 
 			DeclClass *ret = static_cast< DeclClass *>( Mutator::mutate( decl ) );
-			ScrubTyVars::scrub( decl, scopeTyVars );
+			// ScrubTyVars::scrub( decl, scopeTyVars );
+			ScrubTyVars::scrubAll( decl );
 
 			scopeTyVars.endScope();
Index: src/GenPoly/GenPoly.cc
===================================================================
--- src/GenPoly/GenPoly.cc	(revision bf4ac097c572e75965508a6487a639abaf9d6cc9)
+++ src/GenPoly/GenPoly.cc	(revision f2e40a9f50860a5c9c4447c43e425d72254dcf7d)
@@ -15,9 +15,16 @@
 
 #include "GenPoly.h"
+#include "assert.h"
 
 #include "SynTree/Expression.h"
 #include "SynTree/Type.h"
+#include "ResolvExpr/typeops.h"
 
 #include <iostream>
+#include <iterator>
+#include <list>
+#include <typeindex>
+#include <typeinfo>
+#include <vector>
 using namespace std;
 
@@ -38,5 +45,5 @@
 			for ( std::list< Expression* >::iterator param = params.begin(); param != params.end(); ++param ) {
 				TypeExpr *paramType = dynamic_cast< TypeExpr* >( *param );
-				assert(paramType && "Aggregate parameters should be type expressions");
+				assertf(paramType, "Aggregate parameters should be type expressions");
 				if ( isPolyType( paramType->get_type(), tyVars, env ) ) return true;
 			}
@@ -48,6 +55,26 @@
 			for ( std::list< Expression* >::iterator param = params.begin(); param != params.end(); ++param ) {
 				TypeExpr *paramType = dynamic_cast< TypeExpr* >( *param );
-				assert(paramType && "Aggregate parameters should be type expressions");
+				assertf(paramType, "Aggregate parameters should be type expressions");
 				if ( isDynType( paramType->get_type(), tyVars, env ) ) return true;
+			}
+			return false;
+		}
+
+		/// Checks a parameter list for inclusion of polymorphic parameters; will substitute according to env if present
+		bool includesPolyParams( std::list< Expression* >& params, const TypeSubstitution *env ) {
+			for ( std::list< Expression* >::iterator param = params.begin(); param != params.end(); ++param ) {
+				TypeExpr *paramType = dynamic_cast< TypeExpr* >( *param );
+				assertf(paramType, "Aggregate parameters should be type expressions");
+				if ( includesPolyType( paramType->get_type(), env ) ) return true;
+			}
+			return false;
+		}
+
+		/// Checks a parameter list for inclusion of polymorphic parameters from tyVars; will substitute according to env if present
+		bool includesPolyParams( std::list< Expression* >& params, const TyVarMap &tyVars, const TypeSubstitution *env ) {
+			for ( std::list< Expression* >::iterator param = params.begin(); param != params.end(); ++param ) {
+				TypeExpr *paramType = dynamic_cast< TypeExpr* >( *param );
+				assertf(paramType, "Aggregate parameters should be type expressions");
+				if ( includesPolyType( paramType->get_type(), tyVars, env ) ) return true;
 			}
 			return false;
@@ -187,4 +214,36 @@
 
 		return isPolyType( type, tyVars, env );
+	}
+
+	bool includesPolyType( Type *type, const TypeSubstitution *env ) {
+		type = replaceTypeInst( type, env );
+
+		if ( dynamic_cast< TypeInstType * >( type ) ) {
+			return true;
+		} else if ( PointerType *pointerType = dynamic_cast< PointerType* >( type ) ) {
+			if ( includesPolyType( pointerType->get_base(), env ) ) return true;
+		} else if ( StructInstType *structType = dynamic_cast< StructInstType* >( type ) ) {
+			if ( includesPolyParams( structType->get_parameters(), env ) ) return true;
+		} else if ( UnionInstType *unionType = dynamic_cast< UnionInstType* >( type ) ) {
+			if ( includesPolyParams( unionType->get_parameters(), env ) ) return true;
+		}
+		return false;
+	}
+
+	bool includesPolyType( Type *type, const TyVarMap &tyVars, const TypeSubstitution *env ) {
+		type = replaceTypeInst( type, env );
+
+		if ( TypeInstType *typeInstType = dynamic_cast< TypeInstType * >( type ) ) {
+			if ( tyVars.find( typeInstType->get_name() ) != tyVars.end() ) {
+				return true;
+			}
+		} else if ( PointerType *pointerType = dynamic_cast< PointerType* >( type ) ) {
+			if ( includesPolyType( pointerType->get_base(), tyVars, env ) ) return true;
+		} else if ( StructInstType *structType = dynamic_cast< StructInstType* >( type ) ) {
+			if ( includesPolyParams( structType->get_parameters(), tyVars, env ) ) return true;
+		} else if ( UnionInstType *unionType = dynamic_cast< UnionInstType* >( type ) ) {
+			if ( includesPolyParams( unionType->get_parameters(), tyVars, env ) ) return true;
+		}
+		return false;
 	}
 
@@ -237,4 +296,136 @@
 	}
 
+	namespace {
+		/// Checks if is a pointer to D
+		template<typename D, typename B>
+		bool is( const B* p ) { return type_index{typeid(D)} == type_index{typeid(*p)}; }
+
+		/// Converts to a pointer to D without checking for safety
+		template<typename D, typename B>
+		inline D* as( B* p ) { return reinterpret_cast<D*>(p); }
+
+		/// Flattens a declaration list
+		template<typename Output>
+		void flattenList( list< DeclarationWithType* > src, Output out ) {
+			for ( DeclarationWithType* decl : src ) {
+				ResolvExpr::flatten( decl->get_type(), out );
+			}
+		}
+
+		/// Flattens a list of types
+		template<typename Output>
+		void flattenList( list< Type* > src, Output out ) {
+			for ( Type* ty : src ) {
+				ResolvExpr::flatten( ty, out );
+			}
+		}
+
+		/// Checks if two lists of parameters are equal up to polymorphic substitution.
+		bool paramListsPolyCompatible( const list< Expression* >& aparams, const list< Expression* >& bparams ) {
+			if ( aparams.size() != bparams.size() ) return false;
+
+			for ( list< Expression* >::const_iterator at = aparams.begin(), bt = bparams.begin();
+					at != aparams.end(); ++at, ++bt ) {
+				TypeExpr *aparam = dynamic_cast< TypeExpr* >(*at);
+				assertf(aparam, "Aggregate parameters should be type expressions");
+				TypeExpr *bparam = dynamic_cast< TypeExpr* >(*bt);
+				assertf(bparam, "Aggregate parameters should be type expressions");
+
+				// xxx - might need to let VoidType be a wildcard here too; could have some voids 
+				// stuffed in for dtype-statics.
+				// if ( is<VoidType>( aparam->get_type() ) || is<VoidType>( bparam->get_type() ) ) continue;
+				if ( ! typesPolyCompatible( aparam->get_type(), bparam->get_type() ) ) return false;
+			}
+			
+			return true;
+		}
+	}
+
+	bool typesPolyCompatible( Type *a, Type *b ) {
+		type_index aid{ typeid(*a) };
+		// polymorphic types always match
+		if ( aid == type_index{typeid(TypeInstType)} ) return true;
+		
+		type_index bid{ typeid(*b) };
+		// polymorphic types always match
+		if ( bid == type_index{typeid(TypeInstType)} ) return true;
+		
+		// can't match otherwise if different types
+		if ( aid != bid ) return false;
+
+		// recurse through type structure (conditions borrowed from Unify.cc)
+		if ( aid == type_index{typeid(BasicType)} ) {
+			return as<BasicType>(a)->get_kind() == as<BasicType>(b)->get_kind();
+		} else if ( aid == type_index{typeid(PointerType)} ) {
+			PointerType *ap = as<PointerType>(a), *bp = as<PointerType>(b);
+
+			// void pointers should match any other pointer type
+			return is<VoidType>( ap->get_base() ) || is<VoidType>( bp->get_base() )
+				|| typesPolyCompatible( ap->get_base(), bp->get_base() );
+		} else if ( aid == type_index{typeid(ArrayType)} ) {
+			ArrayType *aa = as<ArrayType>(a), *ba = as<ArrayType>(b);
+
+			if ( aa->get_isVarLen() ) {
+				if ( ! ba->get_isVarLen() ) return false;
+			} else {
+				if ( ba->get_isVarLen() ) return false;
+
+				ConstantExpr *ad = dynamic_cast<ConstantExpr*>( aa->get_dimension() );
+				ConstantExpr *bd = dynamic_cast<ConstantExpr*>( ba->get_dimension() );
+				if ( ad && bd 
+						&& ad->get_constant()->get_value() != bd->get_constant()->get_value() )
+					return false;
+			}
+
+			return typesPolyCompatible( aa->get_base(), ba->get_base() );
+		} else if ( aid == type_index{typeid(FunctionType)} ) {
+			FunctionType *af = as<FunctionType>(a), *bf = as<FunctionType>(b);
+
+			vector<Type*> aparams, bparams;
+			flattenList( af->get_parameters(), back_inserter( aparams ) );
+			flattenList( bf->get_parameters(), back_inserter( bparams ) );
+			if ( aparams.size() != bparams.size() ) return false;
+
+			vector<Type*> areturns, breturns;
+			flattenList( af->get_returnVals(), back_inserter( areturns ) );
+			flattenList( bf->get_returnVals(), back_inserter( breturns ) );
+			if ( areturns.size() != breturns.size() ) return false;
+
+			for ( unsigned i = 0; i < aparams.size(); ++i ) {
+				if ( ! typesPolyCompatible( aparams[i], bparams[i] ) ) return false;
+			}
+			for ( unsigned i = 0; i < areturns.size(); ++i ) {
+				if ( ! typesPolyCompatible( areturns[i], breturns[i] ) ) return false;
+			}
+			return true;
+		} else if ( aid == type_index{typeid(StructInstType)} ) {
+			StructInstType *aa = as<StructInstType>(a), *ba = as<StructInstType>(b);
+
+			if ( aa->get_name() != ba->get_name() ) return false;
+			return paramListsPolyCompatible( aa->get_parameters(), ba->get_parameters() );
+		} else if ( aid == type_index{typeid(UnionInstType)} ) {
+			UnionInstType *aa = as<UnionInstType>(a), *ba = as<UnionInstType>(b);
+
+			if ( aa->get_name() != ba->get_name() ) return false;
+			return paramListsPolyCompatible( aa->get_parameters(), ba->get_parameters() );
+		} else if ( aid == type_index{typeid(EnumInstType)} ) {
+			return as<EnumInstType>(a)->get_name() == as<EnumInstType>(b)->get_name();
+		} else if ( aid == type_index{typeid(TraitInstType)} ) {
+			return as<TraitInstType>(a)->get_name() == as<TraitInstType>(b)->get_name();
+		} else if ( aid == type_index{typeid(TupleType)} ) {
+			TupleType *at = as<TupleType>(a), *bt = as<TupleType>(b);
+
+			vector<Type*> atypes, btypes;
+			flattenList( at->get_types(), back_inserter( atypes ) );
+			flattenList( bt->get_types(), back_inserter( btypes ) );
+			if ( atypes.size() != btypes.size() ) return false;
+
+			for ( unsigned i = 0; i < atypes.size(); ++i ) {
+				if ( ! typesPolyCompatible( atypes[i], btypes[i] ) ) return false;
+			}
+			return true;
+		} else return true; // VoidType, VarArgsType, ZeroType & OneType just need the same type
+	}
+
 	void addToTyVarMap( TypeDecl * tyVar, TyVarMap &tyVarMap ) {
 		tyVarMap[ tyVar->get_name() ] = TypeDecl::Data{ tyVar };
Index: src/GenPoly/GenPoly.h
===================================================================
--- src/GenPoly/GenPoly.h	(revision bf4ac097c572e75965508a6487a639abaf9d6cc9)
+++ src/GenPoly/GenPoly.h	(revision f2e40a9f50860a5c9c4447c43e425d72254dcf7d)
@@ -67,4 +67,12 @@
 	Type *hasPolyBase( Type *type, const TyVarMap &tyVars, int *levels = 0, const TypeSubstitution *env = 0 );
 
+	/// true iff this type or some base of this type after dereferencing pointers is either polymorphic or a generic type with at least one 
+	/// polymorphic parameter; will look up substitution in env if provided.
+	bool includesPolyType( Type *type, const TypeSubstitution *env = 0 );
+
+	/// true iff this type or some base of this type after dereferencing pointers is either polymorphic in tyVars, or a generic type with 
+	/// at least one polymorphic parameter in tyVars; will look up substitution in env if provided.
+	bool includesPolyType( Type *type, const TyVarMap &tyVars, const TypeSubstitution *env = 0 );
+
 	/// Returns a pointer to the base FunctionType if ty is the type of a function (or pointer to one), NULL otherwise
 	FunctionType *getFunctionType( Type *ty );
@@ -73,4 +81,7 @@
 	/// N will be stored in levels, if provided
 	VariableExpr *getBaseVar( Expression *expr, int *levels = 0 );
+
+	/// true iff types are structurally identical, where TypeInstType's match any type.
+	bool typesPolyCompatible( Type *aty, Type *bty );
 
 	/// Adds the type variable `tyVar` to `tyVarMap`
Index: src/GenPoly/InstantiateGeneric.cc
===================================================================
--- src/GenPoly/InstantiateGeneric.cc	(revision bf4ac097c572e75965508a6487a639abaf9d6cc9)
+++ src/GenPoly/InstantiateGeneric.cc	(revision f2e40a9f50860a5c9c4447c43e425d72254dcf7d)
@@ -16,7 +16,7 @@
 #include <cassert>
 #include <list>
+#include <unordered_map>
 #include <utility>
 #include <vector>
-#include <unordered_map>
 
 #include "InstantiateGeneric.h"
@@ -25,4 +25,5 @@
 #include "GenPoly.h"
 #include "ScopedSet.h"
+#include "ScrubTyVars.h"
 #include "PolyMutator.h"
 
@@ -77,7 +78,6 @@
 			if ( params.size() != that.params.size() ) return false;
 
-			SymTab::Indexer dummy;
 			for ( std::list< Type* >::const_iterator it = params.begin(), jt = that.params.begin(); it != params.end(); ++it, ++jt ) {
-				if ( ! ResolvExpr::typesCompatible( *it, *jt, dummy ) ) return false;
+				if ( ! typesPolyCompatible( *it, *jt ) ) return false;
 			}
 			return true;
@@ -227,20 +227,14 @@
 			if ( (*baseParam)->isComplete() ) {
 				// substitute parameter for complete (otype or sized dtype) type
-				int pointerLevels = 0;
-				if ( hasPolyBase( paramType->get_type(), &pointerLevels ) && pointerLevels > 0 ) {
-					// Make a void* with equivalent nesting
-					Type* voidPtr = new VoidType( Type::Qualifiers() );
-					while ( pointerLevels > 0 ) {
-						// Just about data layout, so qualifiers *shouldn't* matter
-						voidPtr = new PointerType( Type::Qualifiers(), voidPtr );
-						--pointerLevels;
-					}
-					out.push_back( new TypeExpr( voidPtr ) );
+				if ( isPolyType( paramType->get_type() ) ) {
+					// substitute polymorphic parameter type in to generic type
+					out.push_back( paramType->clone() );
+					gt = genericType::dynamic;
 				} else {
-					// Just clone parameter type
-					out.push_back( paramType->clone() );
+					// normalize possibly dtype-static parameter type
+					out.push_back( new TypeExpr{ 
+						ScrubTyVars::scrubAll( paramType->get_type()->clone() ) } );
+					gt |= genericType::concrete;
 				}
-				// make the struct concrete or dynamic depending on the parameter
-				gt |= isPolyType( paramType->get_type() ) ? genericType::dynamic : genericType::concrete;
 			} else switch ( (*baseParam)->get_kind() ) {
 				case TypeDecl::Dtype:
@@ -372,5 +366,5 @@
 				concDecl = new StructDecl( typeNamer.newName( inst->get_name() ) );
 				concDecl->set_body( inst->get_baseStruct()->has_body() );
-				substituteMembers( inst->get_baseStruct()->get_members(), *inst->get_baseParameters(), typeSubs, 	concDecl->get_members() );
+				substituteMembers( inst->get_baseStruct()->get_members(), *inst->get_baseParameters(), typeSubs, concDecl->get_members() );
 				DeclMutator::addDeclaration( concDecl );
 				insert( inst, typeSubs, concDecl );
Index: src/GenPoly/ScrubTyVars.cc
===================================================================
--- src/GenPoly/ScrubTyVars.cc	(revision bf4ac097c572e75965508a6487a639abaf9d6cc9)
+++ src/GenPoly/ScrubTyVars.cc	(revision f2e40a9f50860a5c9c4447c43e425d72254dcf7d)
@@ -26,6 +26,17 @@
 namespace GenPoly {
 	Type * ScrubTyVars::mutate( TypeInstType *typeInst ) {
-		TyVarMap::const_iterator tyVar = tyVars.find( typeInst->get_name() );
-		if ( tyVar != tyVars.end() ) {
+		if ( ! tyVars ) {
+			if ( typeInst->get_isFtype() ) {
+				delete typeInst;
+				return new PointerType( Type::Qualifiers(), new FunctionType( Type::Qualifiers(), true ) );
+			} else {
+				PointerType *ret = new PointerType( Type::Qualifiers(), new VoidType( typeInst->get_qualifiers() ) );
+				delete typeInst;
+				return ret;
+			}
+		}
+
+		TyVarMap::const_iterator tyVar = tyVars->find( typeInst->get_name() );
+		if ( tyVar != tyVars->end() ) {
 			switch ( tyVar->second.kind ) {
 			  case TypeDecl::Any:
Index: src/GenPoly/ScrubTyVars.h
===================================================================
--- src/GenPoly/ScrubTyVars.h	(revision bf4ac097c572e75965508a6487a639abaf9d6cc9)
+++ src/GenPoly/ScrubTyVars.h	(revision f2e40a9f50860a5c9c4447c43e425d72254dcf7d)
@@ -26,7 +26,12 @@
 namespace GenPoly {
 	class ScrubTyVars : public Mutator {
-	  public:
-		ScrubTyVars( const TyVarMap &tyVars, bool dynamicOnly = false ): tyVars( tyVars ), dynamicOnly( dynamicOnly ) {}
+		/// Whether to scrub all type variables from the provided map, dynamic type variables from the provided map, or all type variables
+		enum ScrubMode { FromMap, DynamicFromMap, All };
 
+		ScrubTyVars() : tyVars(nullptr), mode( All ) {}
+
+		ScrubTyVars( const TyVarMap &tyVars, ScrubMode mode = FromMap ): tyVars( &tyVars ), mode( mode ) {}
+
+	public:
 		/// For all polymorphic types with type variables in `tyVars`, replaces generic types, dtypes, and ftypes with the appropriate void type,
 		/// and sizeof/alignof expressions with the proper variable
@@ -38,4 +43,9 @@
 		template< typename SynTreeClass >
 		static SynTreeClass *scrubDynamic( SynTreeClass *target, const TyVarMap &tyVars );
+
+		/// For all polymorphic types, replaces generic types, dtypes, and ftypes with the appropriate void type,
+		/// and sizeof/alignof expressions with the proper variable
+		template< typename SynTreeClass >
+		static SynTreeClass *scrubAll( SynTreeClass *target );
 
 		virtual Type* mutate( TypeInstType *typeInst );
@@ -49,12 +59,11 @@
 		/// Returns the type if it should be scrubbed, NULL otherwise.
 		Type* shouldScrub( Type *ty ) {
-			return dynamicOnly ? isDynType( ty, tyVars ) : isPolyType( ty, tyVars );
-// 			if ( ! dynamicOnly ) return isPolyType( ty, tyVars );
-// 
-// 			if ( TypeInstType *typeInst = dynamic_cast< TypeInstType* >( ty ) ) {
-// 				return tyVars.find( typeInst->get_name() ) != tyVars.end() ? ty : 0;
-// 			}
-// 
-// 			return isDynType( ty, tyVars );
+			switch ( mode ) {
+			case FromMap: return isPolyType( ty, *tyVars );
+			case DynamicFromMap: return isDynType( ty, *tyVars );
+			case All: return isPolyType( ty );
+			}
+			assert(false); return nullptr; // unreachable
+			// return dynamicOnly ? isDynType( ty, tyVars ) : isPolyType( ty, tyVars );
 		}
 		
@@ -62,6 +71,6 @@
 		Type* mutateAggregateType( Type *ty );
 		
-		const TyVarMap &tyVars;  ///< Type variables to scrub
-		bool dynamicOnly;        ///< only scrub the types with dynamic layout? [false]
+		const TyVarMap *tyVars;  ///< Type variables to scrub
+		ScrubMode mode;          ///< which type variables to scrub? [FromMap]
 	};
 
@@ -74,5 +83,11 @@
 	template< typename SynTreeClass >
 	SynTreeClass * ScrubTyVars::scrubDynamic( SynTreeClass *target, const TyVarMap &tyVars ) {
-		ScrubTyVars scrubber( tyVars, true );
+		ScrubTyVars scrubber( tyVars, ScrubTyVars::DynamicFromMap );
+		return static_cast< SynTreeClass * >( target->acceptMutator( scrubber ) );
+	}
+
+	template< typename SynTreeClass >
+	SynTreeClass * ScrubTyVars::scrubAll( SynTreeClass *target ) {
+		ScrubTyVars scrubber;
 		return static_cast< SynTreeClass * >( target->acceptMutator( scrubber ) );
 	}
Index: src/SymTab/Validate.cc
===================================================================
--- src/SymTab/Validate.cc	(revision bf4ac097c572e75965508a6487a639abaf9d6cc9)
+++ src/SymTab/Validate.cc	(revision f2e40a9f50860a5c9c4447c43e425d72254dcf7d)
@@ -10,6 +10,6 @@
 // Created On       : Sun May 17 21:50:04 2015
 // Last Modified By : Peter A. Buhr
-// Last Modified On : Tue Mar  7 07:51:36 2017
-// Update Count     : 349
+// Last Modified On : Tue Mar 14 23:30:27 2017
+// Update Count     : 350
 //
 
@@ -323,5 +323,5 @@
 			ObjectDecl * obj = dynamic_cast< ObjectDecl * >( *i );
 			assert( obj );
-			obj->set_type( new EnumInstType( Type::Qualifiers( true, false, false, false, false, false ), enumDecl->get_name() ) );
+			obj->set_type( new EnumInstType( Type::Qualifiers( Type::Const ), enumDecl->get_name() ) );
 		} // for
 		Parent::visit( enumDecl );
Index: src/SynTree/Type.h
===================================================================
--- src/SynTree/Type.h	(revision bf4ac097c572e75965508a6487a639abaf9d6cc9)
+++ src/SynTree/Type.h	(revision f2e40a9f50860a5c9c4447c43e425d72254dcf7d)
@@ -10,6 +10,6 @@
 // Created On       : Mon May 18 07:44:20 2015
 // Last Modified By : Peter A. Buhr
-// Last Modified On : Wed Mar 15 21:23:08 2017
-// Update Count     : 84
+// Last Modified On : Wed Mar 15 21:28:09 2017
+// Update Count     : 85
 //
 
@@ -24,28 +24,4 @@
 class Type : public BaseSyntaxNode {
   public:
-	// struct Qualifiers {
-	// 	Qualifiers(): isConst( false ), isVolatile( false ), isRestrict( false ), isLvalue( false ), isAtomic( false ), isMutex( false ) {}
-	// 	Qualifiers( bool isConst, bool isVolatile, bool isRestrict, bool isLvalue, bool isAtomic, bool isMutex ): isConst( isConst ), isVolatile( isVolatile ), isRestrict( isRestrict ), isLvalue( isLvalue ), isAtomic( isAtomic ), isMutex( isMutex ) {}
-
-	// 	Qualifiers &operator&=( const Qualifiers &other );
-	// 	Qualifiers &operator+=( const Qualifiers &other );
-	// 	Qualifiers &operator-=( const Qualifiers &other );
-	// 	Qualifiers operator+( const Type::Qualifiers &other );
-	// 	bool operator==( const Qualifiers &other );
-	// 	bool operator!=( const Qualifiers &other );
-	// 	bool operator<=( const Qualifiers &other );
-	// 	bool operator>=( const Qualifiers &other );
-	// 	bool operator<( const Qualifiers &other );
-	// 	bool operator>( const Qualifiers &other );
-	// 	void print( std::ostream &os, int indent = 0 ) const;
-
-	// 	bool isConst;
-	// 	bool isVolatile;
-	// 	bool isRestrict;
-	// 	bool isLvalue;
-	// 	bool isAtomic;
-	// 	bool isMutex;
-	// };
-
 	static const char * QualifierNames[];
 
@@ -100,5 +76,5 @@
 			return q;
 		}
-	 	void print( std::ostream &os, int indent = 0 ) const {
+	 	void print( std::ostream & os, int indent = 0 ) const {
 			if ( (*this).any() ) {						// any type qualifiers ?
 				for ( unsigned int i = 0; i < NumTypeQualifier; i += 1 ) {
@@ -111,9 +87,9 @@
 	}; // Qualifiers
 
-	Type( const Qualifiers &tq, const std::list< Attribute * > & attributes );
-	Type( const Type &other );
+	Type( const Qualifiers & tq, const std::list< Attribute * > & attributes );
+	Type( const Type & other );
 	virtual ~Type();
 
-	Qualifiers &get_qualifiers() { return tq; }
+	Qualifiers & get_qualifiers() { return tq; }
 	bool get_isConst() { return tq.isConst; }
 	bool get_isVolatile() { return tq.isVolatile; }
@@ -141,7 +117,7 @@
 
 	virtual Type *clone() const = 0;
-	virtual void accept( Visitor &v ) = 0;
-	virtual Type *acceptMutator( Mutator &m ) = 0;
-	virtual void print( std::ostream &os, int indent = 0 ) const;
+	virtual void accept( Visitor & v ) = 0;
+	virtual Type *acceptMutator( Mutator & m ) = 0;
+	virtual void print( std::ostream & os, int indent = 0 ) const;
   private:
 	Qualifiers tq;
@@ -154,5 +130,5 @@
 class VoidType : public Type {
   public:
-	VoidType( const Type::Qualifiers &tq, const std::list< Attribute * > & attributes = std::list< Attribute * >() );
+	VoidType( const Type::Qualifiers & tq, const std::list< Attribute * > & attributes = std::list< Attribute * >() );
 
 	virtual unsigned size() const { return 0; };
@@ -160,7 +136,7 @@
 
 	virtual VoidType *clone() const { return new VoidType( *this ); }
-	virtual void accept( Visitor &v ) { v.visit( this ); }
-	virtual Type *acceptMutator( Mutator &m ) { return m.mutate( this ); }
-	virtual void print( std::ostream &os, int indent = 0 ) const;
+	virtual void accept( Visitor & v ) { v.visit( this ); }
+	virtual Type *acceptMutator( Mutator & m ) { return m.mutate( this ); }
+	virtual void print( std::ostream & os, int indent = 0 ) const;
 };
 
@@ -194,5 +170,5 @@
 	static const char *typeNames[];						// string names for basic types, MUST MATCH with Kind
 
-	BasicType( const Type::Qualifiers &tq, Kind bt, const std::list< Attribute * > & attributes = std::list< Attribute * >() );
+	BasicType( const Type::Qualifiers & tq, Kind bt, const std::list< Attribute * > & attributes = std::list< Attribute * >() );
 
 	Kind get_kind() { return kind; }
@@ -200,7 +176,7 @@
 
 	virtual BasicType *clone() const { return new BasicType( *this ); }
-	virtual void accept( Visitor &v ) { v.visit( this ); }
-	virtual Type *acceptMutator( Mutator &m ) { return m.mutate( this ); }
-	virtual void print( std::ostream &os, int indent = 0 ) const;
+	virtual void accept( Visitor & v ) { v.visit( this ); }
+	virtual Type *acceptMutator( Mutator & m ) { return m.mutate( this ); }
+	virtual void print( std::ostream & os, int indent = 0 ) const;
 
 	bool isInteger() const;
@@ -211,6 +187,6 @@
 class PointerType : public Type {
   public:
-	PointerType( const Type::Qualifiers &tq, Type *base, const std::list< Attribute * > & attributes = std::list< Attribute * >() );
-	PointerType( const Type::Qualifiers &tq, Type *base, Expression *dimension, bool isVarLen, bool isStatic, const std::list< Attribute * > & attributes = std::list< Attribute * >() );
+	PointerType( const Type::Qualifiers & tq, Type *base, const std::list< Attribute * > & attributes = std::list< Attribute * >() );
+	PointerType( const Type::Qualifiers & tq, Type *base, Expression *dimension, bool isVarLen, bool isStatic, const std::list< Attribute * > & attributes = std::list< Attribute * >() );
 	PointerType( const PointerType& );
 	virtual ~PointerType();
@@ -226,7 +202,7 @@
 
 	virtual PointerType *clone() const { return new PointerType( *this ); }
-	virtual void accept( Visitor &v ) { v.visit( this ); }
-	virtual Type *acceptMutator( Mutator &m ) { return m.mutate( this ); }
-	virtual void print( std::ostream &os, int indent = 0 ) const;
+	virtual void accept( Visitor & v ) { v.visit( this ); }
+	virtual Type *acceptMutator( Mutator & m ) { return m.mutate( this ); }
+	virtual void print( std::ostream & os, int indent = 0 ) const;
   private:
 	Type *base;
@@ -240,5 +216,5 @@
 class ArrayType : public Type {
   public:
-	ArrayType( const Type::Qualifiers &tq, Type *base, Expression *dimension, bool isVarLen, bool isStatic, const std::list< Attribute * > & attributes = std::list< Attribute * >() );
+	ArrayType( const Type::Qualifiers & tq, Type *base, Expression *dimension, bool isVarLen, bool isStatic, const std::list< Attribute * > & attributes = std::list< Attribute * >() );
 	ArrayType( const ArrayType& );
 	virtual ~ArrayType();
@@ -256,7 +232,7 @@
 
 	virtual ArrayType *clone() const { return new ArrayType( *this ); }
-	virtual void accept( Visitor &v ) { v.visit( this ); }
-	virtual Type *acceptMutator( Mutator &m ) { return m.mutate( this ); }
-	virtual void print( std::ostream &os, int indent = 0 ) const;
+	virtual void accept( Visitor & v ) { v.visit( this ); }
+	virtual Type *acceptMutator( Mutator & m ) { return m.mutate( this ); }
+	virtual void print( std::ostream & os, int indent = 0 ) const;
   private:
 	Type *base;
@@ -268,5 +244,5 @@
 class FunctionType : public Type {
   public:
-	FunctionType( const Type::Qualifiers &tq, bool isVarArgs, const std::list< Attribute * > & attributes = std::list< Attribute * >() );
+	FunctionType( const Type::Qualifiers & tq, bool isVarArgs, const std::list< Attribute * > & attributes = std::list< Attribute * >() );
 	FunctionType( const FunctionType& );
 	virtual ~FunctionType();
@@ -279,7 +255,7 @@
 
 	virtual FunctionType *clone() const { return new FunctionType( *this ); }
-	virtual void accept( Visitor &v ) { v.visit( this ); }
-	virtual Type *acceptMutator( Mutator &m ) { return m.mutate( this ); }
-	virtual void print( std::ostream &os, int indent = 0 ) const;
+	virtual void accept( Visitor & v ) { v.visit( this ); }
+	virtual Type *acceptMutator( Mutator & m ) { return m.mutate( this ); }
+	virtual void print( std::ostream & os, int indent = 0 ) const;
   private:
 	std::list<DeclarationWithType*> returnVals;
@@ -295,9 +271,9 @@
 class ReferenceToType : public Type {
   public:
-	ReferenceToType( const Type::Qualifiers &tq, const std::string &name, const std::list< Attribute * > & attributes );
-	ReferenceToType( const ReferenceToType &other );
+	ReferenceToType( const Type::Qualifiers & tq, const std::string & name, const std::list< Attribute * > & attributes );
+	ReferenceToType( const ReferenceToType & other );
 	virtual ~ReferenceToType();
 
-	const std::string &get_name() const { return name; }
+	const std::string & get_name() const { return name; }
 	void set_name( std::string newValue ) { name = newValue; }
 	std::list< Expression* >& get_parameters() { return parameters; }
@@ -306,7 +282,7 @@
 
 	virtual ReferenceToType *clone() const = 0;
-	virtual void accept( Visitor &v ) = 0;
-	virtual Type *acceptMutator( Mutator &m ) = 0;
-	virtual void print( std::ostream &os, int indent = 0 ) const;
+	virtual void accept( Visitor & v ) = 0;
+	virtual Type *acceptMutator( Mutator & m ) = 0;
+	virtual void print( std::ostream & os, int indent = 0 ) const;
   protected:
 	virtual std::string typeString() const = 0;
@@ -320,7 +296,7 @@
 	typedef ReferenceToType Parent;
   public:
-	StructInstType( const Type::Qualifiers &tq, const std::string &name, const std::list< Attribute * > & attributes = std::list< Attribute * >()  ) : Parent( tq, name, attributes ), baseStruct( 0 ) {}
-	StructInstType( const Type::Qualifiers &tq, StructDecl * baseStruct, const std::list< Attribute * > & attributes = std::list< Attribute * >()  );
-	StructInstType( const StructInstType &other ) : Parent( other ), baseStruct( other.baseStruct ) {}
+	StructInstType( const Type::Qualifiers & tq, const std::string & name, const std::list< Attribute * > & attributes = std::list< Attribute * >()  ) : Parent( tq, name, attributes ), baseStruct( 0 ) {}
+	StructInstType( const Type::Qualifiers & tq, StructDecl * baseStruct, const std::list< Attribute * > & attributes = std::list< Attribute * >()  );
+	StructInstType( const StructInstType & other ) : Parent( other ), baseStruct( other.baseStruct ) {}
 
 	StructDecl *get_baseStruct() const { return baseStruct; }
@@ -334,11 +310,11 @@
 	/// Looks up the members of this struct named "name" and places them into "foundDecls".
 	/// Clones declarations into "foundDecls", caller responsible for freeing
-	void lookup( const std::string &name, std::list< Declaration* > &foundDecls ) const;
+	void lookup( const std::string & name, std::list< Declaration* > & foundDecls ) const;
 
 	virtual StructInstType *clone() const { return new StructInstType( *this ); }
-	virtual void accept( Visitor &v ) { v.visit( this ); }
-	virtual Type *acceptMutator( Mutator &m ) { return m.mutate( this ); }
-
-	virtual void print( std::ostream &os, int indent = 0 ) const;
+	virtual void accept( Visitor & v ) { v.visit( this ); }
+	virtual Type *acceptMutator( Mutator & m ) { return m.mutate( this ); }
+
+	virtual void print( std::ostream & os, int indent = 0 ) const;
   private:
 	virtual std::string typeString() const;
@@ -352,7 +328,7 @@
 	typedef ReferenceToType Parent;
   public:
-	UnionInstType( const Type::Qualifiers &tq, const std::string &name, const std::list< Attribute * > & attributes = std::list< Attribute * >()  ) : Parent( tq, name, attributes ), baseUnion( 0 ) {}
-	UnionInstType( const Type::Qualifiers &tq, UnionDecl * baseUnion, const std::list< Attribute * > & attributes = std::list< Attribute * >()  );
-	UnionInstType( const UnionInstType &other ) : Parent( other ), baseUnion( other.baseUnion ) {}
+	UnionInstType( const Type::Qualifiers & tq, const std::string & name, const std::list< Attribute * > & attributes = std::list< Attribute * >()  ) : Parent( tq, name, attributes ), baseUnion( 0 ) {}
+	UnionInstType( const Type::Qualifiers & tq, UnionDecl * baseUnion, const std::list< Attribute * > & attributes = std::list< Attribute * >()  );
+	UnionInstType( const UnionInstType & other ) : Parent( other ), baseUnion( other.baseUnion ) {}
 
 	UnionDecl *get_baseUnion() const { return baseUnion; }
@@ -366,11 +342,11 @@
 	/// looks up the members of this union named "name" and places them into "foundDecls"
 	/// Clones declarations into "foundDecls", caller responsible for freeing
-	void lookup( const std::string &name, std::list< Declaration* > &foundDecls ) const;
+	void lookup( const std::string & name, std::list< Declaration* > & foundDecls ) const;
 
 	virtual UnionInstType *clone() const { return new UnionInstType( *this ); }
-	virtual void accept( Visitor &v ) { v.visit( this ); }
-	virtual Type *acceptMutator( Mutator &m ) { return m.mutate( this ); }
-
-	virtual void print( std::ostream &os, int indent = 0 ) const;
+	virtual void accept( Visitor & v ) { v.visit( this ); }
+	virtual Type *acceptMutator( Mutator & m ) { return m.mutate( this ); }
+
+	virtual void print( std::ostream & os, int indent = 0 ) const;
   private:
 	virtual std::string typeString() const;
@@ -384,7 +360,7 @@
 	typedef ReferenceToType Parent;
   public:
-	EnumInstType( const Type::Qualifiers &tq, const std::string &name, const std::list< Attribute * > & attributes = std::list< Attribute * >()  ) : Parent( tq, name, attributes ) {}
-	EnumInstType( const Type::Qualifiers &tq, EnumDecl * baseEnum, const std::list< Attribute * > & attributes = std::list< Attribute * >()  );
-	EnumInstType( const EnumInstType &other ) : Parent( other ), baseEnum( other.baseEnum ) {}
+	EnumInstType( const Type::Qualifiers & tq, const std::string & name, const std::list< Attribute * > & attributes = std::list< Attribute * >()  ) : Parent( tq, name, attributes ) {}
+	EnumInstType( const Type::Qualifiers & tq, EnumDecl * baseEnum, const std::list< Attribute * > & attributes = std::list< Attribute * >()  );
+	EnumInstType( const EnumInstType & other ) : Parent( other ), baseEnum( other.baseEnum ) {}
 
 	EnumDecl *get_baseEnum() const { return baseEnum; }
@@ -394,6 +370,6 @@
 
 	virtual EnumInstType *clone() const { return new EnumInstType( *this ); }
-	virtual void accept( Visitor &v ) { v.visit( this ); }
-	virtual Type *acceptMutator( Mutator &m ) { return m.mutate( this ); }
+	virtual void accept( Visitor & v ) { v.visit( this ); }
+	virtual Type *acceptMutator( Mutator & m ) { return m.mutate( this ); }
   private:
 	virtual std::string typeString() const;
@@ -407,6 +383,6 @@
 	typedef ReferenceToType Parent;
   public:
-	TraitInstType( const Type::Qualifiers &tq, const std::string &name, const std::list< Attribute * > & attributes = std::list< Attribute * >()  ) : Parent( tq, name, attributes ) {}
-	TraitInstType( const TraitInstType &other );
+	TraitInstType( const Type::Qualifiers & tq, const std::string & name, const std::list< Attribute * > & attributes = std::list< Attribute * >()  ) : Parent( tq, name, attributes ) {}
+	TraitInstType( const TraitInstType & other );
 	~TraitInstType();
 
@@ -416,6 +392,6 @@
 
 	virtual TraitInstType *clone() const { return new TraitInstType( *this ); }
-	virtual void accept( Visitor &v ) { v.visit( this ); }
-	virtual Type *acceptMutator( Mutator &m ) { return m.mutate( this ); }
+	virtual void accept( Visitor & v ) { v.visit( this ); }
+	virtual Type *acceptMutator( Mutator & m ) { return m.mutate( this ); }
   private:
 	virtual std::string typeString() const;
@@ -429,7 +405,7 @@
 	typedef ReferenceToType Parent;
   public:
-	TypeInstType( const Type::Qualifiers &tq, const std::string &name, TypeDecl *baseType, const std::list< Attribute * > & attributes = std::list< Attribute * >()  );
-	TypeInstType( const Type::Qualifiers &tq, const std::string &name, bool isFtype, const std::list< Attribute * > & attributes = std::list< Attribute * >()  );
-	TypeInstType( const TypeInstType &other );
+	TypeInstType( const Type::Qualifiers & tq, const std::string & name, TypeDecl *baseType, const std::list< Attribute * > & attributes = std::list< Attribute * >()  );
+	TypeInstType( const Type::Qualifiers & tq, const std::string & name, bool isFtype, const std::list< Attribute * > & attributes = std::list< Attribute * >()  );
+	TypeInstType( const TypeInstType & other );
 	~TypeInstType();
 
@@ -442,7 +418,7 @@
 
 	virtual TypeInstType *clone() const { return new TypeInstType( *this ); }
-	virtual void accept( Visitor &v ) { v.visit( this ); }
-	virtual Type *acceptMutator( Mutator &m ) { return m.mutate( this ); }
-	virtual void print( std::ostream &os, int indent = 0 ) const;
+	virtual void accept( Visitor & v ) { v.visit( this ); }
+	virtual Type *acceptMutator( Mutator & m ) { return m.mutate( this ); }
+	virtual void print( std::ostream & os, int indent = 0 ) const;
   private:
 	virtual std::string typeString() const;
@@ -455,5 +431,5 @@
 class TupleType : public Type {
   public:
-	TupleType( const Type::Qualifiers &tq, const std::list< Type * > & types = std::list< Type * >(), const std::list< Attribute * > & attributes = std::list< Attribute * >()  );
+	TupleType( const Type::Qualifiers & tq, const std::list< Type * > & types = std::list< Type * >(), const std::list< Attribute * > & attributes = std::list< Attribute * >()  );
 	TupleType( const TupleType& );
 	virtual ~TupleType();
@@ -476,7 +452,7 @@
 
 	virtual TupleType *clone() const { return new TupleType( *this ); }
-	virtual void accept( Visitor &v ) { v.visit( this ); }
-	virtual Type *acceptMutator( Mutator &m ) { return m.mutate( this ); }
-	virtual void print( std::ostream &os, int indent = 0 ) const;
+	virtual void accept( Visitor & v ) { v.visit( this ); }
+	virtual Type *acceptMutator( Mutator & m ) { return m.mutate( this ); }
+	virtual void print( std::ostream & os, int indent = 0 ) const;
   private:
 	std::list<Type*> types;
@@ -485,5 +461,5 @@
 class TypeofType : public Type {
   public:
-	TypeofType( const Type::Qualifiers &tq, Expression *expr, const std::list< Attribute * > & attributes = std::list< Attribute * >()  );
+	TypeofType( const Type::Qualifiers & tq, Expression *expr, const std::list< Attribute * > & attributes = std::list< Attribute * >()  );
 	TypeofType( const TypeofType& );
 	virtual ~TypeofType();
@@ -495,7 +471,7 @@
 
 	virtual TypeofType *clone() const { return new TypeofType( *this ); }
-	virtual void accept( Visitor &v ) { v.visit( this ); }
-	virtual Type *acceptMutator( Mutator &m ) { return m.mutate( this ); }
-	virtual void print( std::ostream &os, int indent = 0 ) const;
+	virtual void accept( Visitor & v ) { v.visit( this ); }
+	virtual Type *acceptMutator( Mutator & m ) { return m.mutate( this ); }
+	virtual void print( std::ostream & os, int indent = 0 ) const;
   private:
 	Expression *expr;
@@ -504,11 +480,11 @@
 class AttrType : public Type {
   public:
-	AttrType( const Type::Qualifiers &tq, const std::string &name, Expression *expr, const std::list< Attribute * > & attributes = std::list< Attribute * >() );
-	AttrType( const Type::Qualifiers &tq, const std::string &name, Type *type, const std::list< Attribute * > & attributes = std::list< Attribute * >()  );
+	AttrType( const Type::Qualifiers & tq, const std::string & name, Expression *expr, const std::list< Attribute * > & attributes = std::list< Attribute * >() );
+	AttrType( const Type::Qualifiers & tq, const std::string & name, Type *type, const std::list< Attribute * > & attributes = std::list< Attribute * >()  );
 	AttrType( const AttrType& );
 	virtual ~AttrType();
 
-	const std::string &get_name() const { return name; }
-	void set_name( const std::string &newValue ) { name = newValue; }
+	const std::string & get_name() const { return name; }
+	void set_name( const std::string & newValue ) { name = newValue; }
 	Expression *get_expr() const { return expr; }
 	void set_expr( Expression *newValue ) { expr = newValue; }
@@ -521,7 +497,7 @@
 
 	virtual AttrType *clone() const { return new AttrType( *this ); }
-	virtual void accept( Visitor &v ) { v.visit( this ); }
-	virtual Type *acceptMutator( Mutator &m ) { return m.mutate( this ); }
-	virtual void print( std::ostream &os, int indent = 0 ) const;
+	virtual void accept( Visitor & v ) { v.visit( this ); }
+	virtual Type *acceptMutator( Mutator & m ) { return m.mutate( this ); }
+	virtual void print( std::ostream & os, int indent = 0 ) const;
   private:
 	std::string name;
@@ -540,7 +516,7 @@
 
 	virtual VarArgsType *clone() const { return new VarArgsType( *this ); }
-	virtual void accept( Visitor &v ) { v.visit( this ); }
-	virtual Type *acceptMutator( Mutator &m ) { return m.mutate( this ); }
-	virtual void print( std::ostream &os, int indent = 0 ) const;
+	virtual void accept( Visitor & v ) { v.visit( this ); }
+	virtual Type *acceptMutator( Mutator & m ) { return m.mutate( this ); }
+	virtual void print( std::ostream & os, int indent = 0 ) const;
 };
 
@@ -552,7 +528,7 @@
 
 	virtual ZeroType *clone() const { return new ZeroType( *this ); }
-	virtual void accept( Visitor &v ) { v.visit( this ); }
-	virtual Type *acceptMutator( Mutator &m ) { return m.mutate( this ); }
-	virtual void print( std::ostream &os, int indent = 0 ) const;
+	virtual void accept( Visitor & v ) { v.visit( this ); }
+	virtual Type *acceptMutator( Mutator & m ) { return m.mutate( this ); }
+	virtual void print( std::ostream & os, int indent = 0 ) const;
 };
 
@@ -564,7 +540,7 @@
 
 	virtual OneType *clone() const { return new OneType( *this ); }
-	virtual void accept( Visitor &v ) { v.visit( this ); }
-	virtual Type *acceptMutator( Mutator &m ) { return m.mutate( this ); }
-	virtual void print( std::ostream &os, int indent = 0 ) const;
+	virtual void accept( Visitor & v ) { v.visit( this ); }
+	virtual Type *acceptMutator( Mutator & m ) { return m.mutate( this ); }
+	virtual void print( std::ostream & os, int indent = 0 ) const;
 };
 
Index: src/benchmark/CorCtxSwitch.c
===================================================================
--- src/benchmark/CorCtxSwitch.c	(revision bf4ac097c572e75965508a6487a639abaf9d6cc9)
+++ src/benchmark/CorCtxSwitch.c	(revision f2e40a9f50860a5c9c4447c43e425d72254dcf7d)
@@ -1,5 +1,5 @@
 #include <fstream>
 #include <stdlib>
-#include <threads>
+#include <thread>
 
 #include <unistd.h>					// sysconf
@@ -24,5 +24,5 @@
 
 struct GreatSuspender {
-	coroutine c;
+	coroutine_desc c;
 };
 
Index: src/benchmark/ThrdCtxSwitch.c
===================================================================
--- src/benchmark/ThrdCtxSwitch.c	(revision bf4ac097c572e75965508a6487a639abaf9d6cc9)
+++ src/benchmark/ThrdCtxSwitch.c	(revision f2e40a9f50860a5c9c4447c43e425d72254dcf7d)
@@ -1,5 +1,5 @@
 #include <fstream>
 #include <stdlib>
-#include <threads>
+#include <thread>
 
 #include <unistd.h>					// sysconf
Index: src/benchmark/bench.c
===================================================================
--- src/benchmark/bench.c	(revision bf4ac097c572e75965508a6487a639abaf9d6cc9)
+++ src/benchmark/bench.c	(revision f2e40a9f50860a5c9c4447c43e425d72254dcf7d)
@@ -2,5 +2,5 @@
 #include <fstream>
 #include <stdlib>
-#include <threads>
+#include <thread>
 
 #include <unistd.h>					// sysconf
@@ -86,5 +86,5 @@
 //=======================================
 
-struct CoroutineDummy { coroutine c; };
+struct CoroutineDummy { coroutine_desc c; };
 DECL_COROUTINE(CoroutineDummy);
 void main(CoroutineDummy * this) {}
@@ -119,5 +119,5 @@
 struct CoroutineResume {
     int N;
-    coroutine c;
+    coroutine_desc c;
 };
 
@@ -150,5 +150,5 @@
 //=======================================
 
-struct ThreadDummy { thread t; };
+struct ThreadDummy { thread_desc t; };
 DECL_THREAD(ThreadDummy);
 void main(ThreadDummy * this) {}
@@ -180,5 +180,5 @@
     int N;
     long long result;
-    thread t;
+    thread_desc t;
 };
 
Index: src/benchmark/csv-data.c
===================================================================
--- src/benchmark/csv-data.c	(revision bf4ac097c572e75965508a6487a639abaf9d6cc9)
+++ src/benchmark/csv-data.c	(revision f2e40a9f50860a5c9c4447c43e425d72254dcf7d)
@@ -1,5 +1,5 @@
 #include <fstream>
 #include <stdlib>
-#include <threads>
+#include <thread>
 
 extern "C" {
@@ -26,5 +26,5 @@
 
 struct GreatSuspender {
-	coroutine c;
+	coroutine_desc c;
 };
 
Index: src/examples/multicore.c
===================================================================
--- src/examples/multicore.c	(revision bf4ac097c572e75965508a6487a639abaf9d6cc9)
+++ src/examples/multicore.c	(revision f2e40a9f50860a5c9c4447c43e425d72254dcf7d)
@@ -1,6 +1,6 @@
 #include <kernel>
-#include <threads>
+#include <thread>
 
-struct MyThread { thread t; };
+struct MyThread { thread_desc t; };
 
 DECL_THREAD(MyThread);
Index: src/libcfa/Makefile.am
===================================================================
--- src/libcfa/Makefile.am	(revision bf4ac097c572e75965508a6487a639abaf9d6cc9)
+++ src/libcfa/Makefile.am	(revision f2e40a9f50860a5c9c4447c43e425d72254dcf7d)
@@ -45,5 +45,5 @@
 # not all platforms support concurrency, add option do disable it
 if BUILD_CONCURRENCY
-headers += containers/vector concurrency/coroutines concurrency/threads concurrency/kernel concurrency/monitor
+headers += containers/vector concurrency/coroutine concurrency/thread concurrency/kernel concurrency/monitor
 endif
 
Index: src/libcfa/Makefile.in
===================================================================
--- src/libcfa/Makefile.in	(revision bf4ac097c572e75965508a6487a639abaf9d6cc9)
+++ src/libcfa/Makefile.in	(revision f2e40a9f50860a5c9c4447c43e425d72254dcf7d)
@@ -43,5 +43,5 @@
 
 # not all platforms support concurrency, add option do disable it
-@BUILD_CONCURRENCY_TRUE@am__append_3 = containers/vector concurrency/coroutines concurrency/threads concurrency/kernel concurrency/monitor
+@BUILD_CONCURRENCY_TRUE@am__append_3 = containers/vector concurrency/coroutine concurrency/thread concurrency/kernel concurrency/monitor
 
 # not all platforms support concurrency, add option do disable it
@@ -99,12 +99,12 @@
 am__libcfa_d_a_SOURCES_DIST = libcfa-prelude.c limits.c stdlib.c \
 	math.c iostream.c fstream.c iterator.c rational.c assert.c \
-	containers/vector.c concurrency/coroutines.c \
-	concurrency/threads.c concurrency/kernel.c \
+	containers/vector.c concurrency/coroutine.c \
+	concurrency/thread.c concurrency/kernel.c \
 	concurrency/monitor.c concurrency/CtxSwitch-@MACHINE_TYPE@.S \
 	concurrency/invoke.c
 am__dirstamp = $(am__leading_dot)dirstamp
 @BUILD_CONCURRENCY_TRUE@am__objects_1 = containers/libcfa_d_a-vector.$(OBJEXT) \
-@BUILD_CONCURRENCY_TRUE@	concurrency/libcfa_d_a-coroutines.$(OBJEXT) \
-@BUILD_CONCURRENCY_TRUE@	concurrency/libcfa_d_a-threads.$(OBJEXT) \
+@BUILD_CONCURRENCY_TRUE@	concurrency/libcfa_d_a-coroutine.$(OBJEXT) \
+@BUILD_CONCURRENCY_TRUE@	concurrency/libcfa_d_a-thread.$(OBJEXT) \
 @BUILD_CONCURRENCY_TRUE@	concurrency/libcfa_d_a-kernel.$(OBJEXT) \
 @BUILD_CONCURRENCY_TRUE@	concurrency/libcfa_d_a-monitor.$(OBJEXT)
@@ -124,12 +124,12 @@
 am__libcfa_a_SOURCES_DIST = libcfa-prelude.c limits.c stdlib.c math.c \
 	iostream.c fstream.c iterator.c rational.c assert.c \
-	containers/vector.c concurrency/coroutines.c \
-	concurrency/threads.c concurrency/kernel.c \
+	containers/vector.c concurrency/coroutine.c \
+	concurrency/thread.c concurrency/kernel.c \
 	concurrency/monitor.c concurrency/CtxSwitch-@MACHINE_TYPE@.S \
 	concurrency/invoke.c
 @BUILD_CONCURRENCY_TRUE@am__objects_5 =  \
 @BUILD_CONCURRENCY_TRUE@	containers/libcfa_a-vector.$(OBJEXT) \
-@BUILD_CONCURRENCY_TRUE@	concurrency/libcfa_a-coroutines.$(OBJEXT) \
-@BUILD_CONCURRENCY_TRUE@	concurrency/libcfa_a-threads.$(OBJEXT) \
+@BUILD_CONCURRENCY_TRUE@	concurrency/libcfa_a-coroutine.$(OBJEXT) \
+@BUILD_CONCURRENCY_TRUE@	concurrency/libcfa_a-thread.$(OBJEXT) \
 @BUILD_CONCURRENCY_TRUE@	concurrency/libcfa_a-kernel.$(OBJEXT) \
 @BUILD_CONCURRENCY_TRUE@	concurrency/libcfa_a-monitor.$(OBJEXT)
@@ -175,5 +175,5 @@
 am__nobase_cfa_include_HEADERS_DIST = limits stdlib math iostream \
 	fstream iterator rational assert containers/vector \
-	concurrency/coroutines concurrency/threads concurrency/kernel \
+	concurrency/coroutine concurrency/thread concurrency/kernel \
 	concurrency/monitor ${shell echo stdhdr/*} \
 	concurrency/invoke.h
@@ -397,8 +397,8 @@
 	@$(MKDIR_P) concurrency/$(DEPDIR)
 	@: > concurrency/$(DEPDIR)/$(am__dirstamp)
-concurrency/libcfa_d_a-coroutines.$(OBJEXT):  \
+concurrency/libcfa_d_a-coroutine.$(OBJEXT):  \
 	concurrency/$(am__dirstamp) \
 	concurrency/$(DEPDIR)/$(am__dirstamp)
-concurrency/libcfa_d_a-threads.$(OBJEXT): concurrency/$(am__dirstamp) \
+concurrency/libcfa_d_a-thread.$(OBJEXT): concurrency/$(am__dirstamp) \
 	concurrency/$(DEPDIR)/$(am__dirstamp)
 concurrency/libcfa_d_a-kernel.$(OBJEXT): concurrency/$(am__dirstamp) \
@@ -417,8 +417,7 @@
 containers/libcfa_a-vector.$(OBJEXT): containers/$(am__dirstamp) \
 	containers/$(DEPDIR)/$(am__dirstamp)
-concurrency/libcfa_a-coroutines.$(OBJEXT):  \
-	concurrency/$(am__dirstamp) \
+concurrency/libcfa_a-coroutine.$(OBJEXT): concurrency/$(am__dirstamp) \
 	concurrency/$(DEPDIR)/$(am__dirstamp)
-concurrency/libcfa_a-threads.$(OBJEXT): concurrency/$(am__dirstamp) \
+concurrency/libcfa_a-thread.$(OBJEXT): concurrency/$(am__dirstamp) \
 	concurrency/$(DEPDIR)/$(am__dirstamp)
 concurrency/libcfa_a-kernel.$(OBJEXT): concurrency/$(am__dirstamp) \
@@ -436,14 +435,14 @@
 	-rm -f *.$(OBJEXT)
 	-rm -f concurrency/CtxSwitch-@MACHINE_TYPE@.$(OBJEXT)
-	-rm -f concurrency/libcfa_a-coroutines.$(OBJEXT)
+	-rm -f concurrency/libcfa_a-coroutine.$(OBJEXT)
 	-rm -f concurrency/libcfa_a-invoke.$(OBJEXT)
 	-rm -f concurrency/libcfa_a-kernel.$(OBJEXT)
 	-rm -f concurrency/libcfa_a-monitor.$(OBJEXT)
-	-rm -f concurrency/libcfa_a-threads.$(OBJEXT)
-	-rm -f concurrency/libcfa_d_a-coroutines.$(OBJEXT)
+	-rm -f concurrency/libcfa_a-thread.$(OBJEXT)
+	-rm -f concurrency/libcfa_d_a-coroutine.$(OBJEXT)
 	-rm -f concurrency/libcfa_d_a-invoke.$(OBJEXT)
 	-rm -f concurrency/libcfa_d_a-kernel.$(OBJEXT)
 	-rm -f concurrency/libcfa_d_a-monitor.$(OBJEXT)
-	-rm -f concurrency/libcfa_d_a-threads.$(OBJEXT)
+	-rm -f concurrency/libcfa_d_a-thread.$(OBJEXT)
 	-rm -f containers/libcfa_a-vector.$(OBJEXT)
 	-rm -f containers/libcfa_d_a-vector.$(OBJEXT)
@@ -471,14 +470,14 @@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcfa_d_a-stdlib.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@concurrency/$(DEPDIR)/CtxSwitch-@MACHINE_TYPE@.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@concurrency/$(DEPDIR)/libcfa_a-coroutines.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@concurrency/$(DEPDIR)/libcfa_a-coroutine.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@concurrency/$(DEPDIR)/libcfa_a-invoke.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@concurrency/$(DEPDIR)/libcfa_a-kernel.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@concurrency/$(DEPDIR)/libcfa_a-monitor.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@concurrency/$(DEPDIR)/libcfa_a-threads.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@concurrency/$(DEPDIR)/libcfa_d_a-coroutines.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@concurrency/$(DEPDIR)/libcfa_a-thread.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@concurrency/$(DEPDIR)/libcfa_d_a-coroutine.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@concurrency/$(DEPDIR)/libcfa_d_a-invoke.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@concurrency/$(DEPDIR)/libcfa_d_a-kernel.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@concurrency/$(DEPDIR)/libcfa_d_a-monitor.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@concurrency/$(DEPDIR)/libcfa_d_a-threads.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@concurrency/$(DEPDIR)/libcfa_d_a-thread.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@containers/$(DEPDIR)/libcfa_a-vector.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@containers/$(DEPDIR)/libcfa_d_a-vector.Po@am__quote@
@@ -649,31 +648,31 @@
 @am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -c -o containers/libcfa_d_a-vector.obj `if test -f 'containers/vector.c'; then $(CYGPATH_W) 'containers/vector.c'; else $(CYGPATH_W) '$(srcdir)/containers/vector.c'; fi`
 
-concurrency/libcfa_d_a-coroutines.o: concurrency/coroutines.c
-@am__fastdepCC_TRUE@	$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -MT concurrency/libcfa_d_a-coroutines.o -MD -MP -MF concurrency/$(DEPDIR)/libcfa_d_a-coroutines.Tpo -c -o concurrency/libcfa_d_a-coroutines.o `test -f 'concurrency/coroutines.c' || echo '$(srcdir)/'`concurrency/coroutines.c
-@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) concurrency/$(DEPDIR)/libcfa_d_a-coroutines.Tpo concurrency/$(DEPDIR)/libcfa_d_a-coroutines.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='concurrency/coroutines.c' object='concurrency/libcfa_d_a-coroutines.o' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -c -o concurrency/libcfa_d_a-coroutines.o `test -f 'concurrency/coroutines.c' || echo '$(srcdir)/'`concurrency/coroutines.c
-
-concurrency/libcfa_d_a-coroutines.obj: concurrency/coroutines.c
-@am__fastdepCC_TRUE@	$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -MT concurrency/libcfa_d_a-coroutines.obj -MD -MP -MF concurrency/$(DEPDIR)/libcfa_d_a-coroutines.Tpo -c -o concurrency/libcfa_d_a-coroutines.obj `if test -f 'concurrency/coroutines.c'; then $(CYGPATH_W) 'concurrency/coroutines.c'; else $(CYGPATH_W) '$(srcdir)/concurrency/coroutines.c'; fi`
-@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) concurrency/$(DEPDIR)/libcfa_d_a-coroutines.Tpo concurrency/$(DEPDIR)/libcfa_d_a-coroutines.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='concurrency/coroutines.c' object='concurrency/libcfa_d_a-coroutines.obj' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -c -o concurrency/libcfa_d_a-coroutines.obj `if test -f 'concurrency/coroutines.c'; then $(CYGPATH_W) 'concurrency/coroutines.c'; else $(CYGPATH_W) '$(srcdir)/concurrency/coroutines.c'; fi`
-
-concurrency/libcfa_d_a-threads.o: concurrency/threads.c
-@am__fastdepCC_TRUE@	$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -MT concurrency/libcfa_d_a-threads.o -MD -MP -MF concurrency/$(DEPDIR)/libcfa_d_a-threads.Tpo -c -o concurrency/libcfa_d_a-threads.o `test -f 'concurrency/threads.c' || echo '$(srcdir)/'`concurrency/threads.c
-@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) concurrency/$(DEPDIR)/libcfa_d_a-threads.Tpo concurrency/$(DEPDIR)/libcfa_d_a-threads.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='concurrency/threads.c' object='concurrency/libcfa_d_a-threads.o' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -c -o concurrency/libcfa_d_a-threads.o `test -f 'concurrency/threads.c' || echo '$(srcdir)/'`concurrency/threads.c
-
-concurrency/libcfa_d_a-threads.obj: concurrency/threads.c
-@am__fastdepCC_TRUE@	$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -MT concurrency/libcfa_d_a-threads.obj -MD -MP -MF concurrency/$(DEPDIR)/libcfa_d_a-threads.Tpo -c -o concurrency/libcfa_d_a-threads.obj `if test -f 'concurrency/threads.c'; then $(CYGPATH_W) 'concurrency/threads.c'; else $(CYGPATH_W) '$(srcdir)/concurrency/threads.c'; fi`
-@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) concurrency/$(DEPDIR)/libcfa_d_a-threads.Tpo concurrency/$(DEPDIR)/libcfa_d_a-threads.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='concurrency/threads.c' object='concurrency/libcfa_d_a-threads.obj' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -c -o concurrency/libcfa_d_a-threads.obj `if test -f 'concurrency/threads.c'; then $(CYGPATH_W) 'concurrency/threads.c'; else $(CYGPATH_W) '$(srcdir)/concurrency/threads.c'; fi`
+concurrency/libcfa_d_a-coroutine.o: concurrency/coroutine.c
+@am__fastdepCC_TRUE@	$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -MT concurrency/libcfa_d_a-coroutine.o -MD -MP -MF concurrency/$(DEPDIR)/libcfa_d_a-coroutine.Tpo -c -o concurrency/libcfa_d_a-coroutine.o `test -f 'concurrency/coroutine.c' || echo '$(srcdir)/'`concurrency/coroutine.c
+@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) concurrency/$(DEPDIR)/libcfa_d_a-coroutine.Tpo concurrency/$(DEPDIR)/libcfa_d_a-coroutine.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='concurrency/coroutine.c' object='concurrency/libcfa_d_a-coroutine.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -c -o concurrency/libcfa_d_a-coroutine.o `test -f 'concurrency/coroutine.c' || echo '$(srcdir)/'`concurrency/coroutine.c
+
+concurrency/libcfa_d_a-coroutine.obj: concurrency/coroutine.c
+@am__fastdepCC_TRUE@	$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -MT concurrency/libcfa_d_a-coroutine.obj -MD -MP -MF concurrency/$(DEPDIR)/libcfa_d_a-coroutine.Tpo -c -o concurrency/libcfa_d_a-coroutine.obj `if test -f 'concurrency/coroutine.c'; then $(CYGPATH_W) 'concurrency/coroutine.c'; else $(CYGPATH_W) '$(srcdir)/concurrency/coroutine.c'; fi`
+@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) concurrency/$(DEPDIR)/libcfa_d_a-coroutine.Tpo concurrency/$(DEPDIR)/libcfa_d_a-coroutine.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='concurrency/coroutine.c' object='concurrency/libcfa_d_a-coroutine.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -c -o concurrency/libcfa_d_a-coroutine.obj `if test -f 'concurrency/coroutine.c'; then $(CYGPATH_W) 'concurrency/coroutine.c'; else $(CYGPATH_W) '$(srcdir)/concurrency/coroutine.c'; fi`
+
+concurrency/libcfa_d_a-thread.o: concurrency/thread.c
+@am__fastdepCC_TRUE@	$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -MT concurrency/libcfa_d_a-thread.o -MD -MP -MF concurrency/$(DEPDIR)/libcfa_d_a-thread.Tpo -c -o concurrency/libcfa_d_a-thread.o `test -f 'concurrency/thread.c' || echo '$(srcdir)/'`concurrency/thread.c
+@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) concurrency/$(DEPDIR)/libcfa_d_a-thread.Tpo concurrency/$(DEPDIR)/libcfa_d_a-thread.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='concurrency/thread.c' object='concurrency/libcfa_d_a-thread.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -c -o concurrency/libcfa_d_a-thread.o `test -f 'concurrency/thread.c' || echo '$(srcdir)/'`concurrency/thread.c
+
+concurrency/libcfa_d_a-thread.obj: concurrency/thread.c
+@am__fastdepCC_TRUE@	$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -MT concurrency/libcfa_d_a-thread.obj -MD -MP -MF concurrency/$(DEPDIR)/libcfa_d_a-thread.Tpo -c -o concurrency/libcfa_d_a-thread.obj `if test -f 'concurrency/thread.c'; then $(CYGPATH_W) 'concurrency/thread.c'; else $(CYGPATH_W) '$(srcdir)/concurrency/thread.c'; fi`
+@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) concurrency/$(DEPDIR)/libcfa_d_a-thread.Tpo concurrency/$(DEPDIR)/libcfa_d_a-thread.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='concurrency/thread.c' object='concurrency/libcfa_d_a-thread.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -c -o concurrency/libcfa_d_a-thread.obj `if test -f 'concurrency/thread.c'; then $(CYGPATH_W) 'concurrency/thread.c'; else $(CYGPATH_W) '$(srcdir)/concurrency/thread.c'; fi`
 
 concurrency/libcfa_d_a-kernel.o: concurrency/kernel.c
@@ -845,31 +844,31 @@
 @am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -c -o containers/libcfa_a-vector.obj `if test -f 'containers/vector.c'; then $(CYGPATH_W) 'containers/vector.c'; else $(CYGPATH_W) '$(srcdir)/containers/vector.c'; fi`
 
-concurrency/libcfa_a-coroutines.o: concurrency/coroutines.c
-@am__fastdepCC_TRUE@	$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -MT concurrency/libcfa_a-coroutines.o -MD -MP -MF concurrency/$(DEPDIR)/libcfa_a-coroutines.Tpo -c -o concurrency/libcfa_a-coroutines.o `test -f 'concurrency/coroutines.c' || echo '$(srcdir)/'`concurrency/coroutines.c
-@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) concurrency/$(DEPDIR)/libcfa_a-coroutines.Tpo concurrency/$(DEPDIR)/libcfa_a-coroutines.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='concurrency/coroutines.c' object='concurrency/libcfa_a-coroutines.o' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -c -o concurrency/libcfa_a-coroutines.o `test -f 'concurrency/coroutines.c' || echo '$(srcdir)/'`concurrency/coroutines.c
-
-concurrency/libcfa_a-coroutines.obj: concurrency/coroutines.c
-@am__fastdepCC_TRUE@	$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -MT concurrency/libcfa_a-coroutines.obj -MD -MP -MF concurrency/$(DEPDIR)/libcfa_a-coroutines.Tpo -c -o concurrency/libcfa_a-coroutines.obj `if test -f 'concurrency/coroutines.c'; then $(CYGPATH_W) 'concurrency/coroutines.c'; else $(CYGPATH_W) '$(srcdir)/concurrency/coroutines.c'; fi`
-@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) concurrency/$(DEPDIR)/libcfa_a-coroutines.Tpo concurrency/$(DEPDIR)/libcfa_a-coroutines.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='concurrency/coroutines.c' object='concurrency/libcfa_a-coroutines.obj' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -c -o concurrency/libcfa_a-coroutines.obj `if test -f 'concurrency/coroutines.c'; then $(CYGPATH_W) 'concurrency/coroutines.c'; else $(CYGPATH_W) '$(srcdir)/concurrency/coroutines.c'; fi`
-
-concurrency/libcfa_a-threads.o: concurrency/threads.c
-@am__fastdepCC_TRUE@	$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -MT concurrency/libcfa_a-threads.o -MD -MP -MF concurrency/$(DEPDIR)/libcfa_a-threads.Tpo -c -o concurrency/libcfa_a-threads.o `test -f 'concurrency/threads.c' || echo '$(srcdir)/'`concurrency/threads.c
-@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) concurrency/$(DEPDIR)/libcfa_a-threads.Tpo concurrency/$(DEPDIR)/libcfa_a-threads.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='concurrency/threads.c' object='concurrency/libcfa_a-threads.o' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -c -o concurrency/libcfa_a-threads.o `test -f 'concurrency/threads.c' || echo '$(srcdir)/'`concurrency/threads.c
-
-concurrency/libcfa_a-threads.obj: concurrency/threads.c
-@am__fastdepCC_TRUE@	$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -MT concurrency/libcfa_a-threads.obj -MD -MP -MF concurrency/$(DEPDIR)/libcfa_a-threads.Tpo -c -o concurrency/libcfa_a-threads.obj `if test -f 'concurrency/threads.c'; then $(CYGPATH_W) 'concurrency/threads.c'; else $(CYGPATH_W) '$(srcdir)/concurrency/threads.c'; fi`
-@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) concurrency/$(DEPDIR)/libcfa_a-threads.Tpo concurrency/$(DEPDIR)/libcfa_a-threads.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='concurrency/threads.c' object='concurrency/libcfa_a-threads.obj' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -c -o concurrency/libcfa_a-threads.obj `if test -f 'concurrency/threads.c'; then $(CYGPATH_W) 'concurrency/threads.c'; else $(CYGPATH_W) '$(srcdir)/concurrency/threads.c'; fi`
+concurrency/libcfa_a-coroutine.o: concurrency/coroutine.c
+@am__fastdepCC_TRUE@	$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -MT concurrency/libcfa_a-coroutine.o -MD -MP -MF concurrency/$(DEPDIR)/libcfa_a-coroutine.Tpo -c -o concurrency/libcfa_a-coroutine.o `test -f 'concurrency/coroutine.c' || echo '$(srcdir)/'`concurrency/coroutine.c
+@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) concurrency/$(DEPDIR)/libcfa_a-coroutine.Tpo concurrency/$(DEPDIR)/libcfa_a-coroutine.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='concurrency/coroutine.c' object='concurrency/libcfa_a-coroutine.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -c -o concurrency/libcfa_a-coroutine.o `test -f 'concurrency/coroutine.c' || echo '$(srcdir)/'`concurrency/coroutine.c
+
+concurrency/libcfa_a-coroutine.obj: concurrency/coroutine.c
+@am__fastdepCC_TRUE@	$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -MT concurrency/libcfa_a-coroutine.obj -MD -MP -MF concurrency/$(DEPDIR)/libcfa_a-coroutine.Tpo -c -o concurrency/libcfa_a-coroutine.obj `if test -f 'concurrency/coroutine.c'; then $(CYGPATH_W) 'concurrency/coroutine.c'; else $(CYGPATH_W) '$(srcdir)/concurrency/coroutine.c'; fi`
+@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) concurrency/$(DEPDIR)/libcfa_a-coroutine.Tpo concurrency/$(DEPDIR)/libcfa_a-coroutine.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='concurrency/coroutine.c' object='concurrency/libcfa_a-coroutine.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -c -o concurrency/libcfa_a-coroutine.obj `if test -f 'concurrency/coroutine.c'; then $(CYGPATH_W) 'concurrency/coroutine.c'; else $(CYGPATH_W) '$(srcdir)/concurrency/coroutine.c'; fi`
+
+concurrency/libcfa_a-thread.o: concurrency/thread.c
+@am__fastdepCC_TRUE@	$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -MT concurrency/libcfa_a-thread.o -MD -MP -MF concurrency/$(DEPDIR)/libcfa_a-thread.Tpo -c -o concurrency/libcfa_a-thread.o `test -f 'concurrency/thread.c' || echo '$(srcdir)/'`concurrency/thread.c
+@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) concurrency/$(DEPDIR)/libcfa_a-thread.Tpo concurrency/$(DEPDIR)/libcfa_a-thread.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='concurrency/thread.c' object='concurrency/libcfa_a-thread.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -c -o concurrency/libcfa_a-thread.o `test -f 'concurrency/thread.c' || echo '$(srcdir)/'`concurrency/thread.c
+
+concurrency/libcfa_a-thread.obj: concurrency/thread.c
+@am__fastdepCC_TRUE@	$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -MT concurrency/libcfa_a-thread.obj -MD -MP -MF concurrency/$(DEPDIR)/libcfa_a-thread.Tpo -c -o concurrency/libcfa_a-thread.obj `if test -f 'concurrency/thread.c'; then $(CYGPATH_W) 'concurrency/thread.c'; else $(CYGPATH_W) '$(srcdir)/concurrency/thread.c'; fi`
+@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) concurrency/$(DEPDIR)/libcfa_a-thread.Tpo concurrency/$(DEPDIR)/libcfa_a-thread.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='concurrency/thread.c' object='concurrency/libcfa_a-thread.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -c -o concurrency/libcfa_a-thread.obj `if test -f 'concurrency/thread.c'; then $(CYGPATH_W) 'concurrency/thread.c'; else $(CYGPATH_W) '$(srcdir)/concurrency/thread.c'; fi`
 
 concurrency/libcfa_a-kernel.o: concurrency/kernel.c
Index: src/libcfa/concurrency/coroutine
===================================================================
--- src/libcfa/concurrency/coroutine	(revision f2e40a9f50860a5c9c4447c43e425d72254dcf7d)
+++ src/libcfa/concurrency/coroutine	(revision f2e40a9f50860a5c9c4447c43e425d72254dcf7d)
@@ -0,0 +1,136 @@
+//                              - *- Mode: CFA - *-
+//
+// Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo
+//
+// The contents of this file are covered under the licence agreement in the
+// file "LICENCE" distributed with Cforall.
+//
+// coroutine --
+//
+// Author           : Thierry Delisle
+// Created On       : Mon Nov 28 12:27:26 2016
+// Last Modified By : Thierry Delisle
+// Last Modified On : Mon Nov 28 12:27:26 2016
+// Update Count     : 0
+//
+
+#ifndef COROUTINES_H
+#define COROUTINES_H
+
+#include "assert"
+#include "invoke.h"
+
+//-----------------------------------------------------------------------------
+// Coroutine trait
+// Anything that implements this trait can be resumed.
+// Anything that is resumed is a coroutine.
+trait is_coroutine(dtype T) {
+      void main(T * this);
+      coroutine_desc * get_coroutine(T * this);
+};
+
+#define DECL_COROUTINE(X) static inline coroutine_desc* get_coroutine(X* this) { return &this->c; } void main(X* this)
+
+//-----------------------------------------------------------------------------
+// Ctors and dtors
+void ?{}(coStack_t * this);
+void ?{}(coroutine_desc * this);
+void ?{}(coroutine_desc * this, const char * name);
+void ^?{}(coStack_t * this);
+void ^?{}(coroutine_desc * this);
+
+//-----------------------------------------------------------------------------
+// Public coroutine API
+static inline void suspend();
+
+forall(dtype T | is_coroutine(T))
+static inline void resume(T * cor);
+
+forall(dtype T | is_coroutine(T))
+void prime(T * cor);
+
+//-----------------------------------------------------------------------------
+// PRIVATE exposed because of inline
+
+// Start coroutine routines
+extern "C" {
+      forall(dtype T | is_coroutine(T))
+      void CtxInvokeCoroutine(T * this);
+
+      forall(dtype T | is_coroutine(T))
+      void CtxStart(T * this, void ( *invoke)(T *));
+}
+
+// Get current coroutine
+coroutine_desc * this_coroutine(void);
+
+// Private wrappers for context switch and stack creation
+extern void CoroutineCtxSwitch(coroutine_desc * src, coroutine_desc * dst);
+extern void create_stack( coStack_t * this, unsigned int storageSize );
+
+// Suspend implementation inlined for performance
+static inline void suspend() {
+      coroutine_desc * src = this_coroutine();		// optimization
+
+	assertf( src->last != 0,
+		"Attempt to suspend coroutine \"%.256s\" (%p) that has never been resumed.\n"
+		"Possible cause is a suspend executed in a member called by a coroutine user rather than by the coroutine main.",
+		src->name, src );
+	assertf( src->last->state != Halted,
+		"Attempt by coroutine \"%.256s\" (%p) to suspend back to terminated coroutine \"%.256s\" (%p).\n"
+		"Possible cause is terminated coroutine's main routine has already returned.",
+		src->name, src, src->last->name, src->last );
+
+	CoroutineCtxSwitch( src, src->last );
+}
+
+// Resume implementation inlined for performance
+forall(dtype T | is_coroutine(T))
+static inline void resume(T * cor) {
+	coroutine_desc * src = this_coroutine();		// optimization
+	coroutine_desc * dst = get_coroutine(cor);
+
+      if( unlikely(!dst->stack.base) ) {
+		create_stack(&dst->stack, dst->stack.size);
+		CtxStart(cor, CtxInvokeCoroutine);
+	}
+
+      // not resuming self ?
+	if ( src != dst ) {
+		assertf( dst->state != Halted ,
+			"Attempt by coroutine %.256s (%p) to resume terminated coroutine %.256s (%p).\n"
+			"Possible cause is terminated coroutine's main routine has already returned.",
+			src->name, src, dst->name, dst );
+
+            // set last resumer
+		dst->last = src;
+	} // if
+
+      // always done for performance testing
+	CoroutineCtxSwitch( src, dst );
+}
+
+static inline void resume(coroutine_desc * dst) {
+	coroutine_desc * src = this_coroutine();		// optimization
+
+      // not resuming self ?
+	if ( src != dst ) {
+		assertf( dst->state != Halted ,
+			"Attempt by coroutine %.256s (%p) to resume terminated coroutine %.256s (%p).\n"
+			"Possible cause is terminated coroutine's main routine has already returned.",
+			src->name, src, dst->name, dst );
+
+            // set last resumer
+		dst->last = src;
+	} // if
+
+      // always done for performance testing
+	CoroutineCtxSwitch( src, dst );
+}
+
+#endif //COROUTINES_H
+
+// Local Variables: //
+// mode: c //
+// tab-width: 4 //
+// End: //
Index: src/libcfa/concurrency/coroutine.c
===================================================================
--- src/libcfa/concurrency/coroutine.c	(revision f2e40a9f50860a5c9c4447c43e425d72254dcf7d)
+++ src/libcfa/concurrency/coroutine.c	(revision f2e40a9f50860a5c9c4447c43e425d72254dcf7d)
@@ -0,0 +1,178 @@
+//                              -*- Mode: CFA -*-
+//
+// Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo
+//
+// The contents of this file are covered under the licence agreement in the
+// file "LICENCE" distributed with Cforall.
+//
+// coroutine.c --
+//
+// Author           : Thierry Delisle
+// Created On       : Mon Nov 28 12:27:26 2016
+// Last Modified By : Thierry Delisle
+// Last Modified On : Mon Nov 28 12:27:26 2016
+// Update Count     : 0
+//
+
+#include "coroutine"
+
+extern "C" {
+#include <stddef.h>
+#include <malloc.h>
+#include <errno.h>
+#include <string.h>
+#include <unistd.h>
+#include <sys/mman.h>
+}
+
+#include "kernel"
+#include "libhdr.h"
+
+#define __CFA_INVOKE_PRIVATE__
+#include "invoke.h"
+
+extern thread_local processor * this_processor;
+
+//-----------------------------------------------------------------------------
+// Global state variables
+
+// minimum feasible stack size in bytes
+#define MinStackSize 1000
+static size_t pageSize = 0;				// architecture pagesize HACK, should go in proper runtime singleton
+
+//-----------------------------------------------------------------------------
+// Coroutine ctors and dtors
+void ?{}(coStack_t* this) {
+	this->size		= 10240;	// size of stack
+	this->storage	= NULL;	// pointer to stack
+	this->limit		= NULL;	// stack grows towards stack limit
+	this->base		= NULL;	// base of stack
+	this->context	= NULL;	// address of cfa_context_t
+	this->top		= NULL;	// address of top of storage
+	this->userStack	= false;	
+}
+
+void ?{}(coStack_t* this, size_t size) {
+	this{};
+	this->size = size;
+
+	create_stack(this, this->size);
+}
+
+void ?{}(coroutine_desc* this) {
+	this{ "Anonymous Coroutine" };
+}
+
+void ?{}(coroutine_desc* this, const char * name) {
+	this->name = name;
+	this->errno_ = 0;
+	this->state = Start;
+	this->starter = NULL;
+	this->last = NULL;
+}
+
+void ?{}(coroutine_desc* this, size_t size) {
+	this{};
+	(&this->stack){size};
+}
+
+void ^?{}(coStack_t* this) {
+	if ( ! this->userStack ) {
+		LIB_DEBUG_DO(
+			if ( mprotect( this->storage, pageSize, PROT_READ | PROT_WRITE ) == -1 ) {
+				abortf( "(coStack_t *)%p.^?{}() : internal error, mprotect failure, error(%d) %s.", this, errno, strerror( errno ) );
+			}
+		);
+		free( this->storage );
+	}
+}
+
+void ^?{}(coroutine_desc* this) {}
+
+// Part of the Public API
+// Not inline since only ever called once per coroutine
+forall(dtype T | is_coroutine(T))
+void prime(T* cor) {
+	coroutine_desc* this = get_coroutine(cor);
+	assert(this->state == Start);
+
+	this->state = Primed;
+	resume(cor);
+}
+
+// Wrapper for co
+void CoroutineCtxSwitch(coroutine_desc* src, coroutine_desc* dst) {
+	// THREAD_GETMEM( This )->disableInterrupts();
+
+	// set state of current coroutine to inactive
+	src->state = Inactive;
+
+	// set new coroutine that task is executing
+	this_processor->current_coroutine = dst;
+
+	// context switch to specified coroutine
+	CtxSwitch( src->stack.context, dst->stack.context );
+	// when CtxSwitch returns we are back in the src coroutine		
+
+	// set state of new coroutine to active
+	src->state = Active;
+
+	// THREAD_GETMEM( This )->enableInterrupts();
+} //ctxSwitchDirect
+
+void create_stack( coStack_t* this, unsigned int storageSize ) {
+	//TEMP HACK do this on proper kernel startup
+	if(pageSize == 0ul) pageSize = sysconf( _SC_PAGESIZE );
+
+	size_t cxtSize = libCeiling( sizeof(machine_context_t), 8 ); // minimum alignment
+
+	if ( (intptr_t)this->storage == 0 ) {
+		this->userStack = false;
+		this->size = libCeiling( storageSize, 16 );
+		// use malloc/memalign because "new" raises an exception for out-of-memory
+		
+		// assume malloc has 8 byte alignment so add 8 to allow rounding up to 16 byte alignment
+		LIB_DEBUG_DO( this->storage = memalign( pageSize, cxtSize + this->size + pageSize ) );
+		LIB_NO_DEBUG_DO( this->storage = malloc( cxtSize + this->size + 8 ) );
+
+		LIB_DEBUG_DO(
+			if ( mprotect( this->storage, pageSize, PROT_NONE ) == -1 ) {
+				abortf( "(uMachContext &)%p.createContext() : internal error, mprotect failure, error(%d) %s.", this, (int)errno, strerror( (int)errno ) );
+			} // if
+		);
+
+		if ( (intptr_t)this->storage == 0 ) {
+			abortf( "Attempt to allocate %d bytes of storage for coroutine or task execution-state but insufficient memory available.", this->size );
+		} // if
+
+		LIB_DEBUG_DO( this->limit = (char *)this->storage + pageSize );
+		LIB_NO_DEBUG_DO( this->limit = (char *)libCeiling( (unsigned long)this->storage, 16 ) ); // minimum alignment
+
+	} else {
+		assertf( ((size_t)this->storage & (libAlign() - 1)) != 0ul, "Stack storage %p for task/coroutine must be aligned on %d byte boundary.", this->storage, (int)libAlign() );
+		this->userStack = true;
+		this->size = storageSize - cxtSize;
+
+		if ( this->size % 16 != 0u ) this->size -= 8;
+
+		this->limit = (char *)libCeiling( (unsigned long)this->storage, 16 ); // minimum alignment
+	} // if
+	assertf( this->size >= MinStackSize, "Stack size %d provides less than minimum of %d bytes for a stack.", this->size, MinStackSize );
+
+	this->base = (char *)this->limit + this->size;
+	this->context = this->base;
+	this->top = (char *)this->context + cxtSize;
+}
+
+// We need to call suspend from invoke.c, so we expose this wrapper that
+// is not inline (We can't inline Cforall in C)
+extern "C" {
+	void __suspend_internal(void) {
+		suspend();
+	}
+}
+
+// Local Variables: //
+// mode: c //
+// tab-width: 4 //
+// End: //
Index: c/libcfa/concurrency/coroutines
===================================================================
--- src/libcfa/concurrency/coroutines	(revision bf4ac097c572e75965508a6487a639abaf9d6cc9)
+++ 	(revision )
@@ -1,136 +1,0 @@
-//                              - *- Mode: CFA - *-
-//
-// Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo
-//
-// The contents of this file are covered under the licence agreement in the
-// file "LICENCE" distributed with Cforall.
-//
-// coroutines --
-//
-// Author           : Thierry Delisle
-// Created On       : Mon Nov 28 12:27:26 2016
-// Last Modified By : Thierry Delisle
-// Last Modified On : Mon Nov 28 12:27:26 2016
-// Update Count     : 0
-//
-
-#ifndef COROUTINES_H
-#define COROUTINES_H
-
-#include "assert"
-#include "invoke.h"
-
-//-----------------------------------------------------------------------------
-// Coroutine trait
-// Anything that implements this trait can be resumed.
-// Anything that is resumed is a coroutine.
-trait is_coroutine(dtype T) {
-      void main(T * this);
-      coroutine * get_coroutine(T * this);
-};
-
-#define DECL_COROUTINE(X) static inline coroutine* get_coroutine(X* this) { return &this->c; } void main(X* this)
-
-//-----------------------------------------------------------------------------
-// Ctors and dtors
-void ?{}(coStack_t * this);
-void ?{}(coroutine * this);
-void ?{}(coroutine * this, const char * name);
-void ^?{}(coStack_t * this);
-void ^?{}(coroutine * this);
-
-//-----------------------------------------------------------------------------
-// Public coroutine API
-static inline void suspend();
-
-forall(dtype T | is_coroutine(T))
-static inline void resume(T * cor);
-
-forall(dtype T | is_coroutine(T))
-void prime(T * cor);
-
-//-----------------------------------------------------------------------------
-// PRIVATE exposed because of inline
-
-// Start coroutine routines
-extern "C" {
-      forall(dtype T | is_coroutine(T))
-      void CtxInvokeCoroutine(T * this);
-
-      forall(dtype T | is_coroutine(T))
-      void CtxStart(T * this, void ( *invoke)(T *));
-}
-
-// Get current coroutine
-coroutine * this_coroutine(void);
-
-// Private wrappers for context switch and stack creation
-extern void CoroutineCtxSwitch(coroutine * src, coroutine * dst);
-extern void create_stack( coStack_t * this, unsigned int storageSize );
-
-// Suspend implementation inlined for performance
-static inline void suspend() {
-      coroutine * src = this_coroutine();		// optimization
-
-	assertf( src->last != 0,
-		"Attempt to suspend coroutine \"%.256s\" (%p) that has never been resumed.\n"
-		"Possible cause is a suspend executed in a member called by a coroutine user rather than by the coroutine main.",
-		src->name, src );
-	assertf( src->last->state != Halted,
-		"Attempt by coroutine \"%.256s\" (%p) to suspend back to terminated coroutine \"%.256s\" (%p).\n"
-		"Possible cause is terminated coroutine's main routine has already returned.",
-		src->name, src, src->last->name, src->last );
-
-	CoroutineCtxSwitch( src, src->last );
-}
-
-// Resume implementation inlined for performance
-forall(dtype T | is_coroutine(T))
-static inline void resume(T * cor) {
-	coroutine * src = this_coroutine();		// optimization
-	coroutine * dst = get_coroutine(cor);
-
-      if( unlikely(!dst->stack.base) ) {
-		create_stack(&dst->stack, dst->stack.size);
-		CtxStart(cor, CtxInvokeCoroutine);
-	}
-
-      // not resuming self ?
-	if ( src != dst ) {
-		assertf( dst->state != Halted ,
-			"Attempt by coroutine %.256s (%p) to resume terminated coroutine %.256s (%p).\n"
-			"Possible cause is terminated coroutine's main routine has already returned.",
-			src->name, src, dst->name, dst );
-
-            // set last resumer
-		dst->last = src;
-	} // if
-
-      // always done for performance testing
-	CoroutineCtxSwitch( src, dst );
-}
-
-static inline void resume(coroutine * dst) {
-	coroutine * src = this_coroutine();		// optimization
-
-      // not resuming self ?
-	if ( src != dst ) {
-		assertf( dst->state != Halted ,
-			"Attempt by coroutine %.256s (%p) to resume terminated coroutine %.256s (%p).\n"
-			"Possible cause is terminated coroutine's main routine has already returned.",
-			src->name, src, dst->name, dst );
-
-            // set last resumer
-		dst->last = src;
-	} // if
-
-      // always done for performance testing
-	CoroutineCtxSwitch( src, dst );
-}
-
-#endif //COROUTINES_H
-
-// Local Variables: //
-// mode: c //
-// tab-width: 4 //
-// End: //
Index: c/libcfa/concurrency/coroutines.c
===================================================================
--- src/libcfa/concurrency/coroutines.c	(revision bf4ac097c572e75965508a6487a639abaf9d6cc9)
+++ 	(revision )
@@ -1,178 +1,0 @@
-//                              -*- Mode: CFA -*-
-//
-// Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo
-//
-// The contents of this file are covered under the licence agreement in the
-// file "LICENCE" distributed with Cforall.
-//
-// coroutines.c --
-//
-// Author           : Thierry Delisle
-// Created On       : Mon Nov 28 12:27:26 2016
-// Last Modified By : Thierry Delisle
-// Last Modified On : Mon Nov 28 12:27:26 2016
-// Update Count     : 0
-//
-
-#include "coroutines"
-
-extern "C" {
-#include <stddef.h>
-#include <malloc.h>
-#include <errno.h>
-#include <string.h>
-#include <unistd.h>
-#include <sys/mman.h>
-}
-
-#include "kernel"
-#include "libhdr.h"
-
-#define __CFA_INVOKE_PRIVATE__
-#include "invoke.h"
-
-extern processor * get_this_processor();
-
-//-----------------------------------------------------------------------------
-// Global state variables
-
-// minimum feasible stack size in bytes
-#define MinStackSize 1000
-static size_t pageSize = 0;				// architecture pagesize HACK, should go in proper runtime singleton
-
-//-----------------------------------------------------------------------------
-// Coroutine ctors and dtors
-void ?{}(coStack_t* this) {
-	this->size		= 10240;	// size of stack
-	this->storage	= NULL;	// pointer to stack
-	this->limit		= NULL;	// stack grows towards stack limit
-	this->base		= NULL;	// base of stack
-	this->context	= NULL;	// address of cfa_context_t
-	this->top		= NULL;	// address of top of storage
-	this->userStack	= false;	
-}
-
-void ?{}(coStack_t* this, size_t size) {
-	this{};
-	this->size = size;
-
-	create_stack(this, this->size);
-}
-
-void ?{}(coroutine* this) {
-	this{ "Anonymous Coroutine" };
-}
-
-void ?{}(coroutine* this, const char * name) {
-	this->name = name;
-	this->errno_ = 0;
-	this->state = Start;
-	this->starter = NULL;
-	this->last = NULL;
-}
-
-void ?{}(coroutine* this, size_t size) {
-	this{};
-	(&this->stack){size};
-}
-
-void ^?{}(coStack_t* this) {
-	if ( ! this->userStack ) {
-		LIB_DEBUG_DO(
-			if ( mprotect( this->storage, pageSize, PROT_READ | PROT_WRITE ) == -1 ) {
-				abortf( "(coStack_t *)%p.^?{}() : internal error, mprotect failure, error(%d) %s.", this, errno, strerror( errno ) );
-			}
-		);
-		free( this->storage );
-	}
-}
-
-void ^?{}(coroutine* this) {}
-
-// Part of the Public API
-// Not inline since only ever called once per coroutine
-forall(dtype T | is_coroutine(T))
-void prime(T* cor) {
-	coroutine* this = get_coroutine(cor);
-	assert(this->state == Start);
-
-	this->state = Primed;
-	resume(cor);
-}
-
-// Wrapper for co
-void CoroutineCtxSwitch(coroutine* src, coroutine* dst) {
-	// THREAD_GETMEM( This )->disableInterrupts();
-
-	// set state of current coroutine to inactive
-	src->state = Inactive;
-
-	// set new coroutine that task is executing
-	get_this_processor()->current_coroutine = dst;			
-
-	// context switch to specified coroutine
-	CtxSwitch( src->stack.context, dst->stack.context );
-	// when CtxSwitch returns we are back in the src coroutine		
-
-	// set state of new coroutine to active
-	src->state = Active;
-
-	// THREAD_GETMEM( This )->enableInterrupts();
-} //ctxSwitchDirect
-
-void create_stack( coStack_t* this, unsigned int storageSize ) {
-	//TEMP HACK do this on proper kernel startup
-	if(pageSize == 0ul) pageSize = sysconf( _SC_PAGESIZE );
-
-	size_t cxtSize = libCeiling( sizeof(machine_context_t), 8 ); // minimum alignment
-
-	if ( (intptr_t)this->storage == 0 ) {
-		this->userStack = false;
-		this->size = libCeiling( storageSize, 16 );
-		// use malloc/memalign because "new" raises an exception for out-of-memory
-		
-		// assume malloc has 8 byte alignment so add 8 to allow rounding up to 16 byte alignment
-		LIB_DEBUG_DO( this->storage = memalign( pageSize, cxtSize + this->size + pageSize ) );
-		LIB_NO_DEBUG_DO( this->storage = malloc( cxtSize + this->size + 8 ) );
-
-		LIB_DEBUG_DO(
-			if ( mprotect( this->storage, pageSize, PROT_NONE ) == -1 ) {
-				abortf( "(uMachContext &)%p.createContext() : internal error, mprotect failure, error(%d) %s.", this, (int)errno, strerror( (int)errno ) );
-			} // if
-		);
-
-		if ( (intptr_t)this->storage == 0 ) {
-			abortf( "Attempt to allocate %d bytes of storage for coroutine or task execution-state but insufficient memory available.", this->size );
-		} // if
-
-		LIB_DEBUG_DO( this->limit = (char *)this->storage + pageSize );
-		LIB_NO_DEBUG_DO( this->limit = (char *)libCeiling( (unsigned long)this->storage, 16 ) ); // minimum alignment
-
-	} else {
-		assertf( ((size_t)this->storage & (libAlign() - 1)) != 0ul, "Stack storage %p for task/coroutine must be aligned on %d byte boundary.", this->storage, (int)libAlign() );
-		this->userStack = true;
-		this->size = storageSize - cxtSize;
-
-		if ( this->size % 16 != 0u ) this->size -= 8;
-
-		this->limit = (char *)libCeiling( (unsigned long)this->storage, 16 ); // minimum alignment
-	} // if
-	assertf( this->size >= MinStackSize, "Stack size %d provides less than minimum of %d bytes for a stack.", this->size, MinStackSize );
-
-	this->base = (char *)this->limit + this->size;
-	this->context = this->base;
-	this->top = (char *)this->context + cxtSize;
-}
-
-// We need to call suspend from invoke.c, so we expose this wrapper that
-// is not inline (We can't inline Cforall in C)
-extern "C" {
-	void __suspend_internal(void) {
-		suspend();
-	}
-}
-
-// Local Variables: //
-// mode: c //
-// tab-width: 4 //
-// End: //
Index: src/libcfa/concurrency/invoke.c
===================================================================
--- src/libcfa/concurrency/invoke.c	(revision bf4ac097c572e75965508a6487a639abaf9d6cc9)
+++ src/libcfa/concurrency/invoke.c	(revision f2e40a9f50860a5c9c4447c43e425d72254dcf7d)
@@ -29,14 +29,14 @@
 
 extern void __suspend_internal(void);
-extern void __thread_signal_termination(struct thread*);
+extern void __thread_signal_termination(struct thread_desc*);
 
 void CtxInvokeCoroutine(
       void (*main)(void *), 
-      struct coroutine *(*get_coroutine)(void *), 
+      struct coroutine_desc *(*get_coroutine)(void *), 
       void *this
 ) {
       // LIB_DEBUG_PRINTF("Invoke Coroutine : Received %p (main %p, get_c %p)\n", this, main, get_coroutine);
 
-      struct coroutine* cor = get_coroutine( this );
+      struct coroutine_desc* cor = get_coroutine( this );
 
       if(cor->state == Primed) {
@@ -57,11 +57,11 @@
 void CtxInvokeThread(
       void (*main)(void *), 
-      struct thread *(*get_thread)(void *), 
+      struct thread_desc *(*get_thread)(void *), 
       void *this
 ) {
       __suspend_internal();
 
-      struct thread* thrd = get_thread( this );
-      struct coroutine* cor = &thrd->c;
+      struct thread_desc* thrd = get_thread( this );
+      struct coroutine_desc* cor = &thrd->c;
       cor->state = Active;
 
@@ -79,5 +79,5 @@
 void CtxStart(
       void (*main)(void *), 
-      struct coroutine *(*get_coroutine)(void *), 
+      struct coroutine_desc *(*get_coroutine)(void *), 
       void *this, 
       void (*invoke)(void *)
Index: src/libcfa/concurrency/invoke.h
===================================================================
--- src/libcfa/concurrency/invoke.h	(revision bf4ac097c572e75965508a6487a639abaf9d6cc9)
+++ src/libcfa/concurrency/invoke.h	(revision f2e40a9f50860a5c9c4447c43e425d72254dcf7d)
@@ -35,6 +35,6 @@
 
       struct simple_thread_list {
-            struct thread * head;
-            struct thread ** tail;
+            struct thread_desc * head;
+            struct thread_desc ** tail;
       };
 
@@ -48,6 +48,6 @@
       extern "Cforall" {
             void ?{}( struct simple_thread_list * );
-            void append( struct simple_thread_list *, struct thread * );
-            struct thread * pop_head( struct simple_thread_list * );
+            void append( struct simple_thread_list *, struct thread_desc * );
+            struct thread_desc * pop_head( struct simple_thread_list * );
 
             void ?{}(spinlock * this);
@@ -71,17 +71,17 @@
       enum coroutine_state { Halted, Start, Inactive, Active, Primed };
 
-      struct coroutine {
+      struct coroutine_desc {
             struct coStack_t stack;
             const char *name;			      // textual name for coroutine/task, initialized by uC++ generated code
             int errno_;				      // copy of global UNIX variable errno
             enum coroutine_state state;	      // current execution status for coroutine
-            struct coroutine *starter;	      // first coroutine to resume this one
-            struct coroutine *last;		      // last coroutine to resume this one
+            struct coroutine_desc *starter;	      // first coroutine to resume this one
+            struct coroutine_desc *last;		      // last coroutine to resume this one
       };
 
-      struct thread {
-            struct coroutine c;                 // coroutine body used to store context
+      struct thread_desc {
+            struct coroutine_desc c;                 // coroutine body used to store context
             struct signal_once terminated;      // indicate if execuation state is not halted
-            struct thread * next;               // instrusive link field for threads
+            struct thread_desc * next;               // instrusive link field for threads
       };
 
Index: src/libcfa/concurrency/kernel
===================================================================
--- src/libcfa/concurrency/kernel	(revision bf4ac097c572e75965508a6487a639abaf9d6cc9)
+++ src/libcfa/concurrency/kernel	(revision f2e40a9f50860a5c9c4447c43e425d72254dcf7d)
@@ -6,5 +6,5 @@
 // file "LICENCE" distributed with Cforall.
 //
-// threads --
+// kernel --
 //
 // Author           : Thierry Delisle
@@ -49,5 +49,5 @@
 struct FinishAction {
 	FinishOpCode action_code;
-	thread * thrd;
+	thread_desc * thrd;
 	spinlock * lock;
 };
@@ -62,6 +62,6 @@
 	struct processorCtx_t * runner;
 	cluster * cltr;
-	coroutine * current_coroutine;
-	thread * current_thread;
+	coroutine_desc * current_coroutine;
+	thread_desc * current_thread;
 	pthread_t kernel_thread;
 	
Index: src/libcfa/concurrency/kernel.c
===================================================================
--- src/libcfa/concurrency/kernel.c	(revision bf4ac097c572e75965508a6487a639abaf9d6cc9)
+++ src/libcfa/concurrency/kernel.c	(revision f2e40a9f50860a5c9c4447c43e425d72254dcf7d)
@@ -43,10 +43,10 @@
 KERNEL_STORAGE(cluster, systemCluster);
 KERNEL_STORAGE(processor, systemProcessor);
-KERNEL_STORAGE(thread, mainThread);
+KERNEL_STORAGE(thread_desc, mainThread);
 KERNEL_STORAGE(machine_context_t, mainThread_context);
 
 cluster * systemCluster;
 processor * systemProcessor;
-thread * mainThread;
+thread_desc * mainThread;
 
 //-----------------------------------------------------------------------------
@@ -55,13 +55,9 @@
 thread_local processor * this_processor;
 
-processor * get_this_processor() {
-	return this_processor;
-}
-
-coroutine * this_coroutine(void) {
+coroutine_desc * this_coroutine(void) {
 	return this_processor->current_coroutine;
 }
 
-thread * this_thread(void) {
+thread_desc * this_thread(void) {
 	return this_processor->current_thread;
 }
@@ -103,5 +99,5 @@
 }
 
-void ?{}( coroutine * this, current_stack_info_t * info) {
+void ?{}( coroutine_desc * this, current_stack_info_t * info) {
 	(&this->stack){ info };	
 	this->name = "Main Thread";
@@ -110,5 +106,5 @@
 }
 
-void ?{}( thread * this, current_stack_info_t * info) {
+void ?{}( thread_desc * this, current_stack_info_t * info) {
 	(&this->c){ info };
 }
@@ -179,5 +175,5 @@
 	LIB_DEBUG_PRINTF("Kernel : core %p starting\n", this);
 
-	thread * readyThread = NULL;
+	thread_desc * readyThread = NULL;
 	for( unsigned int spin_count = 0; ! this->is_terminated; spin_count++ ) 
 	{
@@ -206,7 +202,7 @@
 // runThread runs a thread by context switching 
 // from the processor coroutine to the target thread 
-void runThread(processor * this, thread * dst) {
-	coroutine * proc_cor = get_coroutine(this->runner);
-	coroutine * thrd_cor = get_coroutine(dst);
+void runThread(processor * this, thread_desc * dst) {
+	coroutine_desc * proc_cor = get_coroutine(this->runner);
+	coroutine_desc * thrd_cor = get_coroutine(dst);
 	
 	//Reset the terminating actions here
@@ -297,5 +293,5 @@
 //-----------------------------------------------------------------------------
 // Scheduler routines
-void ScheduleThread( thread * thrd ) {
+void ScheduleThread( thread_desc * thrd ) {
 	assertf( thrd->next == NULL, "Expected null got %p", thrd->next );
 	
@@ -305,7 +301,7 @@
 }
 
-thread * nextThread(cluster * this) {
+thread_desc * nextThread(cluster * this) {
 	lock( &this->lock );
-	thread * head = pop_head( &this->ready_queue );
+	thread_desc * head = pop_head( &this->ready_queue );
 	unlock( &this->lock );
 	return head;
@@ -317,19 +313,19 @@
 
 void ScheduleInternal( spinlock * lock ) {
-	get_this_processor()->finish.action_code = Release;
-	get_this_processor()->finish.lock = lock;
+	this_processor->finish.action_code = Release;
+	this_processor->finish.lock = lock;
 	suspend();
 }
 
-void ScheduleInternal( thread * thrd ) {
-	get_this_processor()->finish.action_code = Schedule;
-	get_this_processor()->finish.thrd = thrd;
+void ScheduleInternal( thread_desc * thrd ) {
+	this_processor->finish.action_code = Schedule;
+	this_processor->finish.thrd = thrd;
 	suspend();
 }
 
-void ScheduleInternal( spinlock * lock, thread * thrd ) {
-	get_this_processor()->finish.action_code = Release_Schedule;
-	get_this_processor()->finish.lock = lock;
-	get_this_processor()->finish.thrd = thrd;
+void ScheduleInternal( spinlock * lock, thread_desc * thrd ) {
+	this_processor->finish.action_code = Release_Schedule;
+	this_processor->finish.lock = lock;
+	this_processor->finish.thrd = thrd;
 	suspend();
 }
@@ -343,5 +339,5 @@
 	// SKULLDUGGERY: the mainThread steals the process main thread 
 	// which will then be scheduled by the systemProcessor normally
-	mainThread = (thread *)&mainThread_storage;
+	mainThread = (thread_desc *)&mainThread_storage;
 	current_stack_info_t info;
 	mainThread{ &info };
@@ -440,5 +436,5 @@
 		this->condition = true;
 
-		thread * it;
+		thread_desc * it;
 		while( it = pop_head( &this->blocked) ) {
 			ScheduleThread( it );
@@ -455,5 +451,5 @@
 }
 
-void append( simple_thread_list * this, thread * t ) {
+void append( simple_thread_list * this, thread_desc * t ) {
 	assert(this->tail != NULL);
 	*this->tail = t;
@@ -461,6 +457,6 @@
 }
 
-thread * pop_head( simple_thread_list * this ) {
-	thread * head = this->head;
+thread_desc * pop_head( simple_thread_list * this ) {
+	thread_desc * head = this->head;
 	if( head ) {
 		this->head = head->next;
Index: src/libcfa/concurrency/kernel_private.h
===================================================================
--- src/libcfa/concurrency/kernel_private.h	(revision bf4ac097c572e75965508a6487a639abaf9d6cc9)
+++ src/libcfa/concurrency/kernel_private.h	(revision f2e40a9f50860a5c9c4447c43e425d72254dcf7d)
@@ -6,5 +6,5 @@
 // file "LICENCE" distributed with Cforall.
 //
-// threads --
+// kernel_private.h --
 //
 // Author           : Thierry Delisle
@@ -19,15 +19,15 @@
 
 #include "kernel"
-#include "threads"
+#include "thread"
 
 //-----------------------------------------------------------------------------
 // Scheduler
-void ScheduleThread( thread * );
-thread * nextThread(cluster * this);
+void ScheduleThread( thread_desc * );
+thread_desc * nextThread(cluster * this);
 
 void ScheduleInternal();
 void ScheduleInternal(spinlock * lock);
-void ScheduleInternal(thread * thrd);
-void ScheduleInternal(spinlock * lock, thread * thrd);
+void ScheduleInternal(thread_desc * thrd);
+void ScheduleInternal(spinlock * lock, thread_desc * thrd);
 
 //-----------------------------------------------------------------------------
@@ -35,5 +35,5 @@
 struct processorCtx_t {
 	processor * proc;
-	coroutine c;
+	coroutine_desc c;
 };
 
@@ -42,5 +42,5 @@
 void main(processorCtx_t *);
 void start(processor * this);
-void runThread(processor * this, thread * dst);
+void runThread(processor * this, thread_desc * dst);
 void finishRunning(processor * this);
 void spin(processor * this, unsigned int * spin_count);
@@ -53,5 +53,5 @@
 }
 
-extern void ThreadCtxSwitch(coroutine * src, coroutine * dst);
+extern void ThreadCtxSwitch(coroutine_desc * src, coroutine_desc * dst);
 
 #endif //KERNEL_PRIVATE_H
Index: src/libcfa/concurrency/monitor
===================================================================
--- src/libcfa/concurrency/monitor	(revision bf4ac097c572e75965508a6487a639abaf9d6cc9)
+++ src/libcfa/concurrency/monitor	(revision f2e40a9f50860a5c9c4447c43e425d72254dcf7d)
@@ -22,12 +22,12 @@
 #include "stdlib"
 
-struct __monitor_t {
+struct monitor_desc {
 	spinlock lock;
-	thread * owner;
+	thread_desc * owner;
 	simple_thread_list entry_queue;
 	unsigned int recursion;
 };
 
-static inline void ?{}(__monitor_t * this) {
+static inline void ?{}(monitor_desc * this) {
 	this->owner = 0;
 	this->recursion = 0;
@@ -35,21 +35,21 @@
 
 //Basic entering routine
-void enter(__monitor_t *);
-void leave(__monitor_t *);
+void enter(monitor_desc *);
+void leave(monitor_desc *);
 
 //Array entering routine
-void enter(__monitor_t **, int count);
-void leave(__monitor_t **, int count);
+void enter(monitor_desc **, int count);
+void leave(monitor_desc **, int count);
 
 struct monitor_guard_t {
-	__monitor_t ** m;
+	monitor_desc ** m;
 	int count;
 };
 
-static inline int ?<?(__monitor_t* lhs, __monitor_t* rhs) {
+static inline int ?<?(monitor_desc* lhs, monitor_desc* rhs) {
 	return ((intptr_t)lhs) < ((intptr_t)rhs);
 }
 
-static inline void ?{}( monitor_guard_t * this, __monitor_t ** m ) {
+static inline void ?{}( monitor_guard_t * this, monitor_desc ** m ) {
 	this->m = m;
 	this->count = 1;
@@ -57,5 +57,5 @@
 }
 
-static inline void ?{}( monitor_guard_t * this, __monitor_t ** m, int count ) {
+static inline void ?{}( monitor_guard_t * this, monitor_desc ** m, int count ) {
 	this->m = m;
 	this->count = count;
Index: src/libcfa/concurrency/monitor.c
===================================================================
--- src/libcfa/concurrency/monitor.c	(revision bf4ac097c572e75965508a6487a639abaf9d6cc9)
+++ src/libcfa/concurrency/monitor.c	(revision f2e40a9f50860a5c9c4447c43e425d72254dcf7d)
@@ -6,5 +6,5 @@
 // file "LICENCE" distributed with Cforall.
 //
-// __monitor_t.c --
+// monitor_desc.c --
 //
 // Author           : Thierry Delisle
@@ -19,7 +19,7 @@
 #include "kernel_private.h"
 
-void enter(__monitor_t * this) {
+void enter(monitor_desc * this) {
 	lock( &this->lock );
-	thread * thrd = this_thread();
+	thread_desc * thrd = this_thread();
 
 	if( !this->owner ) {
@@ -45,8 +45,8 @@
 }
 
-void leave(__monitor_t * this) {
+void leave(monitor_desc * this) {
 	lock( &this->lock );
 
-	thread * thrd = this_thread();
+	thread_desc * thrd = this_thread();
 	assert( thrd == this->owner );
 
@@ -55,5 +55,5 @@
 
 	//If we left the last level of recursion it means we are changing who owns the monitor
-	thread * new_owner = 0;
+	thread_desc * new_owner = 0;
 	if( this->recursion == 0) {
 		//Get the next thread in the list
@@ -72,5 +72,5 @@
 }
 
-void enter(__monitor_t ** monitors, int count) {
+void enter(monitor_desc ** monitors, int count) {
 	for(int i = 0; i < count; i++) {
 		// printf("%d\n", i);
@@ -79,5 +79,5 @@
 }
 
-void leave(__monitor_t ** monitors, int count) {
+void leave(monitor_desc ** monitors, int count) {
 	for(int i = count - 1; i >= 0; i--) {
 		// printf("%d\n", i);
Index: src/libcfa/concurrency/thread
===================================================================
--- src/libcfa/concurrency/thread	(revision f2e40a9f50860a5c9c4447c43e425d72254dcf7d)
+++ src/libcfa/concurrency/thread	(revision f2e40a9f50860a5c9c4447c43e425d72254dcf7d)
@@ -0,0 +1,76 @@
+//                              -*- Mode: CFA -*-
+//
+// Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo
+//
+// The contents of this file are covered under the licence agreement in the
+// file "LICENCE" distributed with Cforall.
+//
+// thread --
+//
+// Author           : Thierry Delisle
+// Created On       : Tue Jan 17 12:27:26 2017
+// Last Modified By : Thierry Delisle
+// Last Modified On : --
+// Update Count     : 0
+//
+
+#ifndef THREADS_H
+#define THREADS_H
+
+#include "assert"
+#include "invoke.h"
+
+#include "coroutine"
+
+//-----------------------------------------------------------------------------
+// Coroutine trait
+// Anything that implements this trait can be resumed.
+// Anything that is resumed is a coroutine.
+trait is_thread(dtype T) {
+      void main(T* this);
+      thread_desc* get_thread(T* this);
+};
+
+#define DECL_THREAD(X) thread_desc* get_thread(X* this) { return &this->t; } void main(X* this)
+
+forall( dtype T | is_thread(T) )
+static inline coroutine_desc* get_coroutine(T* this) {
+	return &get_thread(this)->c;
+}
+
+static inline coroutine_desc* get_coroutine(thread_desc* this) {
+	return &this->c;
+}
+
+thread_desc * this_thread(void);
+
+//-----------------------------------------------------------------------------
+// Ctors and dtors
+void ?{}(thread_desc* this);
+void ^?{}(thread_desc* this);
+
+//-----------------------------------------------------------------------------
+// thread runner
+// Structure that actually start and stop threads
+forall( dtype T | sized(T) | is_thread(T) )
+struct scoped {
+	T handle;
+};
+
+forall( dtype T | sized(T) | is_thread(T) | { void ?{}(T*); } )
+void ?{}( scoped(T)* this );
+
+forall( dtype T, ttype P | sized(T) | is_thread(T) | { void ?{}(T*, P); } )
+void ?{}( scoped(T)* this, P params );
+
+forall( dtype T | sized(T) | is_thread(T) | { void ^?{}(T*); } )
+void ^?{}( scoped(T)* this );
+
+void yield();
+
+#endif //THREADS_H
+
+// Local Variables: //
+// mode: c //
+// tab-width: 4 //
+// End: //
Index: src/libcfa/concurrency/thread.c
===================================================================
--- src/libcfa/concurrency/thread.c	(revision f2e40a9f50860a5c9c4447c43e425d72254dcf7d)
+++ src/libcfa/concurrency/thread.c	(revision f2e40a9f50860a5c9c4447c43e425d72254dcf7d)
@@ -0,0 +1,131 @@
+//                              -*- Mode: CFA -*-
+//
+// Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo
+//
+// The contents of this file are covered under the licence agreement in the
+// file "LICENCE" distributed with Cforall.
+//
+// thread.c --
+//
+// Author           : Thierry Delisle
+// Created On       : Tue Jan 17 12:27:26 2017
+// Last Modified By : Thierry Delisle
+// Last Modified On : --
+// Update Count     : 0
+//
+
+#include "thread"
+
+#include "kernel_private.h"
+#include "libhdr.h"
+
+#define __CFA_INVOKE_PRIVATE__
+#include "invoke.h"
+
+extern "C" {
+	#include <fenv.h>
+	#include <stddef.h>
+}
+
+extern thread_local processor * this_processor;
+
+//-----------------------------------------------------------------------------
+// Forward declarations
+forall( dtype T | is_thread(T) )
+void start( T* this );
+
+forall( dtype T | is_thread(T) )
+void stop( T* this );
+
+//-----------------------------------------------------------------------------
+// Thread ctors and dtors
+
+void ?{}(thread_desc* this) {
+	(&this->c){};
+	this->c.name = "Anonymous Coroutine";
+	(&this->terminated){};
+	this->next = NULL;
+}
+
+void ^?{}(thread_desc* this) {
+	^(&this->c){};
+}
+
+forall( dtype T | sized(T) | is_thread(T) | { void ?{}(T*); } )
+void ?{}( scoped(T)* this ) {
+	(&this->handle){};
+	start(&this->handle);
+}
+
+forall( dtype T, ttype P | sized(T) | is_thread(T) | { void ?{}(T*, P); } )
+void ?{}( scoped(T)* this, P params ) {
+	(&this->handle){ params };
+	start(&this->handle);
+}
+
+forall( dtype T | sized(T) | is_thread(T) | { void ^?{}(T*); } )
+void ^?{}( scoped(T)* this ) {
+	stop(&this->handle);
+	^(&this->handle){};
+}
+
+//-----------------------------------------------------------------------------
+// Starting and stopping threads
+forall( dtype T | is_thread(T) )
+void start( T* this ) {
+	coroutine_desc* thrd_c = get_coroutine(this);
+	thread_desc*  thrd_h = get_thread   (this);
+	thrd_c->last = this_coroutine();
+	this_processor->current_coroutine = thrd_c;
+
+	LIB_DEBUG_PRINTF("Thread start : %p (t %p, c %p)\n", this, thrd_c, thrd_h);
+
+	create_stack(&thrd_c->stack, thrd_c->stack.size);
+	CtxStart(this, CtxInvokeThread);
+	CtxSwitch( thrd_c->last->stack.context, thrd_c->stack.context );
+
+	ScheduleThread(thrd_h);
+}
+
+forall( dtype T | is_thread(T) )
+void stop( T* this ) {
+	wait( & get_thread(this)->terminated );	
+}
+
+void yield( void ) {
+	ScheduleInternal( this_processor->current_thread );
+}
+
+void ThreadCtxSwitch(coroutine_desc* src, coroutine_desc* dst) {
+	// set state of current coroutine to inactive
+	src->state = Inactive;
+	dst->state = Active;
+
+	//update the last resumer
+	dst->last = src;
+
+	// set new coroutine that the processor is executing
+	// and context switch to it
+	this_processor->current_coroutine = dst;
+	CtxSwitch( src->stack.context, dst->stack.context );
+	this_processor->current_coroutine = src;
+
+	// set state of new coroutine to active
+	dst->state = Inactive;
+	src->state = Active;
+}
+
+// C Helper to signal the termination of a thread_desc
+// Used in invoke.c
+extern "C" {
+	void __thread_signal_termination( thread_desc * this ) {
+		this->c.state = Halted;
+		LIB_DEBUG_PRINTF("Thread end : %p\n", this);
+		signal( &this->terminated );	
+	}
+}
+
+// Local Variables: //
+// mode: c //
+// tab-width: 4 //
+// End: //
Index: c/libcfa/concurrency/threads
===================================================================
--- src/libcfa/concurrency/threads	(revision bf4ac097c572e75965508a6487a639abaf9d6cc9)
+++ 	(revision )
@@ -1,76 +1,0 @@
-//                              -*- Mode: CFA -*-
-//
-// Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo
-//
-// The contents of this file are covered under the licence agreement in the
-// file "LICENCE" distributed with Cforall.
-//
-// threads --
-//
-// Author           : Thierry Delisle
-// Created On       : Tue Jan 17 12:27:26 2017
-// Last Modified By : Thierry Delisle
-// Last Modified On : --
-// Update Count     : 0
-//
-
-#ifndef THREADS_H
-#define THREADS_H
-
-#include "assert"
-#include "invoke.h"
-
-#include "coroutines"
-
-//-----------------------------------------------------------------------------
-// Coroutine trait
-// Anything that implements this trait can be resumed.
-// Anything that is resumed is a coroutine.
-trait is_thread(dtype T) {
-      void main(T* this);
-      thread* get_thread(T* this);
-};
-
-#define DECL_THREAD(X) thread* get_thread(X* this) { return &this->t; } void main(X* this)
-
-forall( dtype T | is_thread(T) )
-static inline coroutine* get_coroutine(T* this) {
-	return &get_thread(this)->c;
-}
-
-static inline coroutine* get_coroutine(thread* this) {
-	return &this->c;
-}
-
-thread * this_thread(void);
-
-//-----------------------------------------------------------------------------
-// Ctors and dtors
-void ?{}(thread* this);
-void ^?{}(thread* this);
-
-//-----------------------------------------------------------------------------
-// thread runner
-// Structure that actually start and stop threads
-forall( dtype T | sized(T) | is_thread(T) )
-struct scoped {
-	T handle;
-};
-
-forall( dtype T | sized(T) | is_thread(T) | { void ?{}(T*); } )
-void ?{}( scoped(T)* this );
-
-forall( dtype T, ttype P | sized(T) | is_thread(T) | { void ?{}(T*, P); } )
-void ?{}( scoped(T)* this, P params );
-
-forall( dtype T | sized(T) | is_thread(T) | { void ^?{}(T*); } )
-void ^?{}( scoped(T)* this );
-
-void yield();
-
-#endif //THREADS_H
-
-// Local Variables: //
-// mode: c //
-// tab-width: 4 //
-// End: //
Index: c/libcfa/concurrency/threads.c
===================================================================
--- src/libcfa/concurrency/threads.c	(revision bf4ac097c572e75965508a6487a639abaf9d6cc9)
+++ 	(revision )
@@ -1,131 +1,0 @@
-//                              -*- Mode: CFA -*-
-//
-// Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo
-//
-// The contents of this file are covered under the licence agreement in the
-// file "LICENCE" distributed with Cforall.
-//
-// threads.c --
-//
-// Author           : Thierry Delisle
-// Created On       : Tue Jan 17 12:27:26 2017
-// Last Modified By : Thierry Delisle
-// Last Modified On : --
-// Update Count     : 0
-//
-
-#include "threads"
-
-#include "kernel_private.h"
-#include "libhdr.h"
-
-#define __CFA_INVOKE_PRIVATE__
-#include "invoke.h"
-
-extern "C" {
-	#include <fenv.h>
-	#include <stddef.h>
-}
-
-extern processor * get_this_processor();
-
-//-----------------------------------------------------------------------------
-// Forward declarations
-forall( dtype T | is_thread(T) )
-void start( T* this );
-
-forall( dtype T | is_thread(T) )
-void stop( T* this );
-
-//-----------------------------------------------------------------------------
-// Thread ctors and dtors
-
-void ?{}(thread* this) {
-	(&this->c){};
-	this->c.name = "Anonymous Coroutine";
-	(&this->terminated){};
-	this->next = NULL;
-}
-
-void ^?{}(thread* this) {
-	^(&this->c){};
-}
-
-forall( dtype T | sized(T) | is_thread(T) | { void ?{}(T*); } )
-void ?{}( scoped(T)* this ) {
-	(&this->handle){};
-	start(&this->handle);
-}
-
-forall( dtype T, ttype P | sized(T) | is_thread(T) | { void ?{}(T*, P); } )
-void ?{}( scoped(T)* this, P params ) {
-	(&this->handle){ params };
-	start(&this->handle);
-}
-
-forall( dtype T | sized(T) | is_thread(T) | { void ^?{}(T*); } )
-void ^?{}( scoped(T)* this ) {
-	stop(&this->handle);
-	^(&this->handle){};
-}
-
-//-----------------------------------------------------------------------------
-// Starting and stopping threads
-forall( dtype T | is_thread(T) )
-void start( T* this ) {
-	coroutine* thrd_c = get_coroutine(this);
-	thread*  thrd_h = get_thread   (this);
-	thrd_c->last = this_coroutine();
-	get_this_processor()->current_coroutine = thrd_c;
-
-	LIB_DEBUG_PRINTF("Thread start : %p (t %p, c %p)\n", this, thrd_c, thrd_h);
-
-	create_stack(&thrd_c->stack, thrd_c->stack.size);
-	CtxStart(this, CtxInvokeThread);
-	CtxSwitch( thrd_c->last->stack.context, thrd_c->stack.context );
-
-	ScheduleThread(thrd_h);
-}
-
-forall( dtype T | is_thread(T) )
-void stop( T* this ) {
-	wait( & get_thread(this)->terminated );	
-}
-
-void yield( void ) {
-	ScheduleInternal( get_this_processor()->current_thread );
-}
-
-void ThreadCtxSwitch(coroutine* src, coroutine* dst) {
-	// set state of current coroutine to inactive
-	src->state = Inactive;
-	dst->state = Active;
-
-	//update the last resumer
-	dst->last = src;
-
-	// set new coroutine that the processor is executing
-	// and context switch to it
-	get_this_processor()->current_coroutine = dst;	
-	CtxSwitch( src->stack.context, dst->stack.context );
-	get_this_processor()->current_coroutine = src;	
-
-	// set state of new coroutine to active
-	dst->state = Inactive;
-	src->state = Active;
-}
-
-// C Helper to signal the termination of a thread
-// Used in invoke.c
-extern "C" {
-	void __thread_signal_termination( thread * this ) {
-		this->c.state = Halted;
-		LIB_DEBUG_PRINTF("Thread end : %p\n", this);
-		signal( &this->terminated );	
-	}
-}
-
-// Local Variables: //
-// mode: c //
-// tab-width: 4 //
-// End: //
Index: src/tests/coroutine.c
===================================================================
--- src/tests/coroutine.c	(revision bf4ac097c572e75965508a6487a639abaf9d6cc9)
+++ src/tests/coroutine.c	(revision f2e40a9f50860a5c9c4447c43e425d72254dcf7d)
@@ -1,8 +1,8 @@
 #include <fstream>
-#include <coroutines>
+#include <coroutine>
 
 struct Fibonacci {
       int fn; // used for communication
-      coroutine c;
+      coroutine_desc c;
 };
 
@@ -11,5 +11,5 @@
 }
 
-coroutine* get_coroutine(Fibonacci* this) {
+coroutine_desc* get_coroutine(Fibonacci* this) {
       return &this->c;
 }
@@ -47,7 +47,7 @@
 #ifdef MORE_DEBUG      
       Fibonacci *pf1 = &f1, *pf2 = &f2;
-      coroutine *cf1 = &f1.c, *cf2 = &f2.c;
+      coroutine_desc *cf1 = &f1.c, *cf2 = &f2.c;
       covptr_t  *vf1 = vtable(pf1), *vf2 = vtable(pf2);
-      coroutine *cv1 = get_coroutine(vf1), *cv2 = get_coroutine(vf2);
+      coroutine_desc *cv1 = get_coroutine(vf1), *cv2 = get_coroutine(vf2);
       Fibonacci *ov1 = (Fibonacci *)get_object(vf1), *ov2 = (Fibonacci *)get_object(vf2);
 
Index: src/tests/monitor.c
===================================================================
--- src/tests/monitor.c	(revision bf4ac097c572e75965508a6487a639abaf9d6cc9)
+++ src/tests/monitor.c	(revision f2e40a9f50860a5c9c4447c43e425d72254dcf7d)
@@ -2,9 +2,9 @@
 #include <kernel>
 #include <monitor>
-#include <threads>
+#include <thread>
 
 struct global_t {
 	int value;
-	__monitor_t m;
+	monitor_desc m;
 };
 
@@ -16,5 +16,5 @@
 
 void increment( /*mutex*/ global_t * this ) {
-	__monitor_t * mon = &this->m;
+	monitor_desc * mon = &this->m;
 	monitor_guard_t g1 = { &mon };
 	{
@@ -27,5 +27,5 @@
 }
 
-struct MyThread { thread t; };
+struct MyThread { thread_desc t; };
 
 DECL_THREAD(MyThread);
Index: src/tests/multi-monitor.c
===================================================================
--- src/tests/multi-monitor.c	(revision bf4ac097c572e75965508a6487a639abaf9d6cc9)
+++ src/tests/multi-monitor.c	(revision f2e40a9f50860a5c9c4447c43e425d72254dcf7d)
@@ -2,12 +2,12 @@
 #include <kernel>
 #include <monitor>
-#include <threads>
+#include <thread>
 
 static int global12, global23, global13;
 
-static __monitor_t m1, m2, m3;
+static monitor_desc m1, m2, m3;
 
-void increment( /*mutex*/ __monitor_t * p1, /*mutex*/ __monitor_t * p2, int * value ) {
-	__monitor_t * mons[] = { p1, p2 };
+void increment( /*mutex*/ monitor_desc * p1, /*mutex*/ monitor_desc * p2, int * value ) {
+	monitor_desc * mons[] = { p1, p2 };
 	monitor_guard_t g = { mons, 2 };
 	*value += 1;
@@ -15,5 +15,5 @@
 
 struct MyThread { 
-	thread t; 
+	thread_desc t; 
 	int target;
 };
Index: src/tests/test.py
===================================================================
--- src/tests/test.py	(revision bf4ac097c572e75965508a6487a639abaf9d6cc9)
+++ src/tests/test.py	(revision f2e40a9f50860a5c9c4447c43e425d72254dcf7d)
@@ -250,5 +250,5 @@
 parser = argparse.ArgumentParser(description='Script which runs cforall tests')
 parser.add_argument('--debug', help='Run all tests in debug or release', type=yes_no, default='no')
-parser.add_argument('--concurrent', help='Run concurrent tests', type=yes_no, default='no')
+parser.add_argument('--concurrent', help='Run concurrent tests', type=yes_no, default='yes')
 parser.add_argument('--dry-run', help='Don\'t run the tests, only output the commands', action='store_true')
 parser.add_argument('--list', help='List all test available', action='store_true')
Index: src/tests/thread.c
===================================================================
--- src/tests/thread.c	(revision bf4ac097c572e75965508a6487a639abaf9d6cc9)
+++ src/tests/thread.c	(revision f2e40a9f50860a5c9c4447c43e425d72254dcf7d)
@@ -2,8 +2,8 @@
 #include <kernel>
 #include <stdlib>
-#include <threads>
+#include <thread>
 
-struct First { thread t; signal_once* lock; };
-struct Second { thread t; signal_once* lock; };
+struct First { thread_desc t; signal_once* lock; };
+struct Second { thread_desc t; signal_once* lock; };
 
 DECL_THREAD(First);
