+static void *__context_wrapper(void *c)
+{
+ xbt_context_t context = c;
+ int i;
+
+#ifdef USE_PTHREADS
+ DEBUG0("**** Lock ****");
+ pthread_mutex_lock(&(context->mutex));
+ DEBUG0("**** Releasing the prisonner ****");
+ pthread_cond_signal(&(context->cond));
+ DEBUG0("**** Going to Jail ****");
+ pthread_cond_wait(&(context->cond), &(context->mutex));
+ DEBUG0("**** Unlocking ****");
+ pthread_mutex_unlock(&(context->mutex));
+#endif
+
+ if(context->startup_func)
+ context->startup_func(context->startup_arg);
+
+ DEBUG0("Calling the main function");
+ (context->code) (context->argc,context->argv);
+
+ for(i=0;i<context->argc; i++)
+ if(context->argv[i]) free(context->argv[i]);
+ if(context->argv) free(context->argv);
+
+ if(context->cleanup_func)
+ context->cleanup_func(context->cleanup_arg);
+
+ xbt_swag_remove(context, context_living);
+ xbt_swag_insert(context, context_to_destroy);
+
+ __xbt_context_yield(context);
+ xbt_assert0(0,"You're cannot be here!");
+ return NULL;
+}
+
+/** \name Functions
+ * \ingroup XBT_context
+ */
+/* @{ */
+/** Context module initialization
+ *
+ * \warning It has to be called before using any other function of this module.
+ */