Index: src/examples/multicore.c
===================================================================
--- src/examples/multicore.c	(revision 9243cc9182698807efb210be324a644e9f390bae)
+++ src/examples/multicore.c	(revision 0ea1b65137b1cab670e971a4da6728f9daff37e3)
@@ -1,4 +1,4 @@
 #include <kernel>
-#include <threads>
+#include <thread>
 
 struct MyThread { thread t; };
Index: src/libcfa/Makefile.am
===================================================================
--- src/libcfa/Makefile.am	(revision 9243cc9182698807efb210be324a644e9f390bae)
+++ src/libcfa/Makefile.am	(revision 0ea1b65137b1cab670e971a4da6728f9daff37e3)
@@ -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 9243cc9182698807efb210be324a644e9f390bae)
+++ src/libcfa/Makefile.in	(revision 0ea1b65137b1cab670e971a4da6728f9daff37e3)
@@ -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 0ea1b65137b1cab670e971a4da6728f9daff37e3)
+++ src/libcfa/concurrency/coroutine	(revision 0ea1b65137b1cab670e971a4da6728f9daff37e3)
@@ -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 * 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: src/libcfa/concurrency/coroutine.c
===================================================================
--- src/libcfa/concurrency/coroutine.c	(revision 0ea1b65137b1cab670e971a4da6728f9daff37e3)
+++ src/libcfa/concurrency/coroutine.c	(revision 0ea1b65137b1cab670e971a4da6728f9daff37e3)
@@ -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 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: c/libcfa/concurrency/coroutines
===================================================================
--- src/libcfa/concurrency/coroutines	(revision 9243cc9182698807efb210be324a644e9f390bae)
+++ 	(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 9243cc9182698807efb210be324a644e9f390bae)
+++ 	(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/kernel
===================================================================
--- src/libcfa/concurrency/kernel	(revision 9243cc9182698807efb210be324a644e9f390bae)
+++ src/libcfa/concurrency/kernel	(revision 0ea1b65137b1cab670e971a4da6728f9daff37e3)
@@ -6,5 +6,5 @@
 // file "LICENCE" distributed with Cforall.
 //
-// threads --
+// kernel --
 //
 // Author           : Thierry Delisle
Index: src/libcfa/concurrency/kernel_private.h
===================================================================
--- src/libcfa/concurrency/kernel_private.h	(revision 9243cc9182698807efb210be324a644e9f390bae)
+++ src/libcfa/concurrency/kernel_private.h	(revision 0ea1b65137b1cab670e971a4da6728f9daff37e3)
@@ -6,5 +6,5 @@
 // file "LICENCE" distributed with Cforall.
 //
-// threads --
+// kernel_private.h --
 //
 // Author           : Thierry Delisle
@@ -19,5 +19,5 @@
 
 #include "kernel"
-#include "threads"
+#include "thread"
 
 //-----------------------------------------------------------------------------
Index: src/libcfa/concurrency/thread
===================================================================
--- src/libcfa/concurrency/thread	(revision 0ea1b65137b1cab670e971a4da6728f9daff37e3)
+++ src/libcfa/concurrency/thread	(revision 0ea1b65137b1cab670e971a4da6728f9daff37e3)
@@ -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* 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: src/libcfa/concurrency/thread.c
===================================================================
--- src/libcfa/concurrency/thread.c	(revision 0ea1b65137b1cab670e971a4da6728f9daff37e3)
+++ src/libcfa/concurrency/thread.c	(revision 0ea1b65137b1cab670e971a4da6728f9daff37e3)
@@ -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 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: c/libcfa/concurrency/threads
===================================================================
--- src/libcfa/concurrency/threads	(revision 9243cc9182698807efb210be324a644e9f390bae)
+++ 	(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 9243cc9182698807efb210be324a644e9f390bae)
+++ 	(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 9243cc9182698807efb210be324a644e9f390bae)
+++ src/tests/coroutine.c	(revision 0ea1b65137b1cab670e971a4da6728f9daff37e3)
@@ -1,4 +1,4 @@
 #include <fstream>
-#include <coroutines>
+#include <coroutine>
 
 struct Fibonacci {
Index: src/tests/monitor.c
===================================================================
--- src/tests/monitor.c	(revision 9243cc9182698807efb210be324a644e9f390bae)
+++ src/tests/monitor.c	(revision 0ea1b65137b1cab670e971a4da6728f9daff37e3)
@@ -2,5 +2,5 @@
 #include <kernel>
 #include <monitor>
-#include <threads>
+#include <thread>
 
 struct global_t {
Index: src/tests/multi-monitor.c
===================================================================
--- src/tests/multi-monitor.c	(revision 9243cc9182698807efb210be324a644e9f390bae)
+++ src/tests/multi-monitor.c	(revision 0ea1b65137b1cab670e971a4da6728f9daff37e3)
@@ -2,5 +2,5 @@
 #include <kernel>
 #include <monitor>
-#include <threads>
+#include <thread>
 
 static int global12, global23, global13;
Index: src/tests/thread.c
===================================================================
--- src/tests/thread.c	(revision 9243cc9182698807efb210be324a644e9f390bae)
+++ src/tests/thread.c	(revision 0ea1b65137b1cab670e971a4da6728f9daff37e3)
@@ -2,5 +2,5 @@
 #include <kernel>
 #include <stdlib>
-#include <threads>
+#include <thread>
 
 struct First { thread t; signal_once* lock; };
