Index: src/libcfa/concurrency/threads
===================================================================
--- src/libcfa/concurrency/threads	(revision 9129a848d87bdbb3434b3db7693cba174b561aae)
+++ src/libcfa/concurrency/threads	(revision c5cb613099f2fdd80518c1423be411f72bd629c4)
@@ -1,15 +1,16 @@
+//                              -*- Mode: CFA -*-
 //
-// Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo
+// 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.
 //
-// fstream --
+// threads --
 //
-// Author           : Peter A. Buhr
-// Created On       : Wed May 27 17:56:53 2015
-// Last Modified By : Peter A. Buhr
-// Last Modified On : Thu Apr 28 08:08:04 2016
-// Update Count     : 88
+// 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
 //
 
@@ -19,9 +20,36 @@
 #include <stdbool.h>
 
-struct coroutine {
-      coroutine* last;
-      const char* name;
-      bool notHalted;
-};
+extern "C" {
+      struct coVtable {
+            void (*main)(void*);
+            struct coroutine* (*this_coroutine)(void*);
+      };
+
+      struct coStack_t {
+            unsigned int size;		// size of stack
+            void *storage;			// pointer to stack
+            void *limit;			// stack grows towards stack limit
+            void *base;				// base of stack
+            void *context;			// address of cfa_context_t
+            void *top;				// address of top of storage
+            bool userStack;	
+      };
+
+
+      enum coroutine_state { Start, Inactive, Active, Halt };
+
+      struct coroutine {
+            coStack_t stack;
+            const char *name;			// textual name for coroutine/task, initialized by uC++ generated code
+            int errno_;				// copy of global UNIX variable errno
+            coroutine_state state;	      // current execution status for coroutine
+            bool notHalted;			// indicate if execuation state is not halted
+
+            coroutine *starter;		// first coroutine to resume this one
+            coroutine *last;			// last coroutine to resume this one
+      };
+}
+
+void ?{}(coStack_t* this);
 
 void ?{}(coroutine* this);
@@ -29,5 +57,10 @@
 trait coroutine_t(dtype T) {
       coroutine* this_coroutine(T* this);
+      void co_main(T* this);
+      coVtable* vtable(T* this);
 };
+
+forall(dtype T | coroutine_t(T))
+void start(T* cor);
 
 void suspend(void);
@@ -37,2 +70,7 @@
 
 #endif //__THREADS_H__
+
+// Local Variables: //
+// mode: c //
+// tab-width: 4 //
+// End: //
