Index: doc/theses/thierry_delisle_PhD/code/readQ_example/Makefile
===================================================================
--- doc/theses/thierry_delisle_PhD/code/readQ_example/Makefile	(revision a4bdbcde528eb16d7cf6708cb3ecd21bc7935139)
+++ doc/theses/thierry_delisle_PhD/code/readQ_example/Makefile	(revision a4bdbcde528eb16d7cf6708cb3ecd21bc7935139)
@@ -0,0 +1,6 @@
+all: gui-proto
+
+CXXFLAGS = -fpic -g -O0 -I.
+
+gui-proto: proto-gui/main.o thrdlib/thread.o
+	$(CXX) -pthread -ldl -o ${@} ${^} -ftls-model=initial-exec
Index: doc/theses/thierry_delisle_PhD/code/readQ_example/proto-gui/main.cpp
===================================================================
--- doc/theses/thierry_delisle_PhD/code/readQ_example/proto-gui/main.cpp	(revision 29185fc0ff744b0a61a984c92e468727a9c9bf75)
+++ doc/theses/thierry_delisle_PhD/code/readQ_example/proto-gui/main.cpp	(revision a4bdbcde528eb16d7cf6708cb3ecd21bc7935139)
@@ -12,4 +12,26 @@
 using thrdlib::thread_t;
 
+
+extern __attribute__((aligned(128))) thread_local struct {
+	void * volatile this_thread;
+	void * volatile this_processor;
+	void * volatile this_stats;
+
+	struct {
+		volatile unsigned short disable_count;
+		volatile bool enabled;
+		volatile bool in_progress;
+	} preemption_state;
+
+	#if defined(__SIZEOF_INT128__)
+		__uint128_t rand_seed;
+	#else
+		uint64_t rand_seed;
+	#endif
+	struct {
+		uint64_t fwd_seed;
+		uint64_t bck_seed;
+	} ready_rng;
+} kernelTLS __attribute__ ((tls_model ( "initial-exec" )));
 
 //--------------------
@@ -182,4 +204,6 @@
 	nproduce = 60;
 
+	const char * framework;
+
 	for(;;) {
 		static struct option options[] = {
@@ -199,4 +223,10 @@
 			case -1:
 				/* paranoid */ assert(optind <= argc);
+				if( optind == argc ) {
+					std::cerr << "Must specify a framework" << std::endl;
+					goto usage;
+
+				}
+				framework = argv[optind];
 				goto run;
 			case 'b':
@@ -231,5 +261,5 @@
 				std::cerr << opt << std::endl;
 			usage:
-				std::cerr << "Usage: " << argv[0] << " [options]" << std::endl;
+				std::cerr << "Usage: " << argv[0] << " [options] framework" << std::endl;
 				std::cerr << std::endl;
 				std::cerr << "  -b, --buff=COUNT    Number of frames to buffer" << std::endl;
@@ -240,4 +270,5 @@
 	}
 	run:
+	assert( framework );
 
 	frames.reset(new Frame[nframes]);
@@ -249,5 +280,5 @@
 	std::cout << "(Buffering " << nframes << ")" << std::endl;
 
-	thrdlib::init( "fibre", 2 );
+	thrdlib::init( framework, 2 );
 
 	thread_t stats     = thrdlib::create( Stats );
Index: doc/theses/thierry_delisle_PhD/code/readQ_example/thrdlib/Makefile
===================================================================
--- doc/theses/thierry_delisle_PhD/code/readQ_example/thrdlib/Makefile	(revision 29185fc0ff744b0a61a984c92e468727a9c9bf75)
+++ doc/theses/thierry_delisle_PhD/code/readQ_example/thrdlib/Makefile	(revision a4bdbcde528eb16d7cf6708cb3ecd21bc7935139)
@@ -1,10 +1,19 @@
-all: fibre.so pthread.so
+all: fibre.so pthread.so cforall.so
 
 clean:
 	rm -rf fibre.so pthread.so
 
+CXXFLAGS=-Wall -Wextra -O3 -g -fpic -std=c++17 -pthread -ftls-model=initial-exec
+
 pthread.so: pthread.cpp Makefile
-	$(CXX) -Wall -Wextra -O3 -g -shared -o ${@} -pthread -fpic ${<}
+	$(CXX) $(CXXFLAGS) -shared -o ${@} ${<}
 
 fibre.so: fibre.cpp Makefile
-	$(CXX) -Wall -Wextra -O3 -g -shared -o ${@} -pthread -fpic ${<} -lfibre
+	$(CXX) $(CXXFLAGS) -shared -o ${@} ${<} -lfibre
+
+CFAINC=${HOME}/local/include/cfa-dev
+CFALIB=${HOME}/local/lib/cfa-dev/x64-debug
+CFAFLAGS=-z execstack -I${CFAINC} -I${CFAINC}/concurrency -L${CFALIB} -Wl,-rpath,${CFALIB}
+
+cforall.so: cforall.cpp Makefile
+	$(CXX) $(CXXFLAGS) $(CFAFLAGS) -shared -o ${@} ${<} -lcfathread -lcfa -ldl -lm
Index: doc/theses/thierry_delisle_PhD/code/readQ_example/thrdlib/cforall.cpp
===================================================================
--- doc/theses/thierry_delisle_PhD/code/readQ_example/thrdlib/cforall.cpp	(revision a4bdbcde528eb16d7cf6708cb3ecd21bc7935139)
+++ doc/theses/thierry_delisle_PhD/code/readQ_example/thrdlib/cforall.cpp	(revision a4bdbcde528eb16d7cf6708cb3ecd21bc7935139)
@@ -0,0 +1,43 @@
+#include <cassert>
+#include <clib/cfathread.h>
+
+typedef cfathread_t thread_t;
+static_assert(sizeof(thread_t) == sizeof(void*), "thread_t musst be of same size as void*");
+
+#if !defined(__cplusplus)
+#error no __cplusplus define!
+#endif
+
+extern "C" {
+	//--------------------
+	// Basic thread support
+	thread_t thrdlib_create( void (*the_main)( thread_t ) ) {
+		return cfathread_create( the_main );
+	}
+
+	void thrdlib_join( thread_t handle ) {
+		cfathread_join( handle );
+	}
+
+	void thrdlib_park( thread_t ) {
+		cfathread_park();
+	}
+
+	void thrdlib_unpark( thread_t handle ) {
+		cfathread_unpark( handle );
+	}
+
+	void thrdlib_yield( void ) {
+		cfathread_yield();
+	}
+
+	//--------------------
+	// Basic kernel features
+	void thrdlib_init( int procs ) {
+		cfathread_setproccnt(procs);
+	}
+
+	void thrdlib_clean( void ) {
+		cfathread_setproccnt(1);
+	}
+}
Index: doc/theses/thierry_delisle_PhD/code/readQ_example/thrdlib/thread.cpp
===================================================================
--- doc/theses/thierry_delisle_PhD/code/readQ_example/thrdlib/thread.cpp	(revision 29185fc0ff744b0a61a984c92e468727a9c9bf75)
+++ doc/theses/thierry_delisle_PhD/code/readQ_example/thrdlib/thread.cpp	(revision a4bdbcde528eb16d7cf6708cb3ecd21bc7935139)
@@ -28,5 +28,5 @@
 
 	const char * error = dlerror();
-	if ( error ) {
+	if ( required && error ) {
 		std::cerr << "Fetching symbol '" << symbol << "' failed with error '" << error << "'\n";
 		std::abort();
