+#ifdef USE_PTHREADS
+ /* Launch the thread */
+ DEBUG1("**[%p]** Locking ****",context);
+ pthread_mutex_lock(&(context->mutex));
+ DEBUG1("**[%p]** Pthread create ****",context);
+ xbt_assert0(!pthread_create(context->thread, NULL, __context_wrapper, context),
+ "Unable to create a thread.");
+ DEBUG2("**[%p]** Pthread created : %p ****",context,(void*)(*(context->thread)));
+ DEBUG1("**[%p]** Going to jail ****",context);
+ pthread_cond_wait(&(context->cond), &(context->mutex));
+ DEBUG1("**[%p]** Unlocking ****",context);
+ pthread_mutex_unlock(&(context->mutex));
+#else
+ makecontext (&(context->uc), (void (*) (void)) __context_wrapper,
+ 1, context);
+#endif
+ return;
+}
+
+/**
+ * \param code a main function
+ * \param startup_func a function to call when running the context for
+ * the first time and just before the main function \a code
+ * \param startup_arg the argument passed to the previous function (\a startup_func)
+ * \param cleanup_func a function to call when running the context, just after
+ the termination of the main function \a code
+ * \param cleanup_arg the argument passed to the previous function (\a cleanup_func)
+ * \param argc first argument of function \a code
+ * \param argv seconde argument of function \a code
+ */
+xbt_context_t xbt_context_new(xbt_context_function_t code,
+ void_f_pvoid_t startup_func, void *startup_arg,
+ void_f_pvoid_t cleanup_func, void *cleanup_arg,
+ int argc, char *argv[])
+{
+ xbt_context_t res = NULL;