void smx_ctx_cojava_stop(smx_context_t context)
{
  /*
   * The java stack needs to be empty, otherwise weird stuff
   * will happen
   */
  if (context->iwannadie) {
    context->iwannadie = 0;
    JNIEnv *env = get_current_thread_env();
    // TODO it will be nice to have the name of the process to help the end-user to know which Process has been killed
    jxbt_throw_by_name(env, "org/simgrid/msg/ProcessKilledError", xbt_strdup("Process killed :) (file smx_context_cojava.c)"));
    THROWF(cancel_error, 0, "process cancelled");
  }
  else {
    smx_ctx_base_stop(context);
    smx_ctx_cojava_suspend(context);
  }
}
static void smx_ctx_boost_stop_parallel(smx_context_t context)
{
  smx_ctx_base_stop(context);
  smx_ctx_boost_suspend_parallel(context);
}
static void smx_ctx_boost_stop_serial(smx_context_t context)
{
  smx_ctx_base_stop(context);
  simix_global->context_factory->suspend(context);
}