+/** Garbage collection
+ *
+ * Should be called some time to time to free the memory allocated for contexts
+ * that have finished executing their main functions.
+ */
+void xbt_context_empty_trash(void)
+{
+ xbt_context_t context=NULL;
+
+ while((context=xbt_swag_extract(context_to_destroy)))
+ xbt_context_destroy(context);
+}
+
+/**
+ * \param context the context to start
+ *
+ * Calling this function prepares \a context to be run. It will
+ however run effectively only when calling #xbt_context_schedule
+ */
+void xbt_context_start(xbt_context_t context)
+{
+#ifdef USE_PTHREADS
+ /* Launch the thread */
+ DEBUG0("**** Locking ****");
+ pthread_mutex_lock(&(context->mutex));
+ DEBUG0("**** Pthread create ****");
+ xbt_assert0(!pthread_create(context->thread, NULL, __context_wrapper, context),
+ "Unable to create a thread.");
+ DEBUG0("**** Going to jail ****");
+ pthread_cond_wait(&(context->cond), &(context->mutex));
+ DEBUG0("**** Unlocking ****");
+ pthread_mutex_unlock(&(context->mutex));
+#else