-static void smx_ctx_sysv_wrapper()
-{
- /*FIXME: I would like to avoid accesing simix_global to get the current
- context by passing it as an argument of the wrapper function. The problem
- is that this function is called from smx_ctx_sysv_start, and uses
- makecontext for calling it, and the stupid posix specification states that
- all the arguments of the function should be int(32 bits), making it useless
- in 64-bit architectures where pointers are 64 bit long.
- */
- smx_ctx_lua_t context =
- (smx_ctx_lua_t)simix_global->current_process->context;
-
- (context->code) (context->argc, context->argv);
-
- smx_ctx_lua_stop((smx_context_t)context);
-}
-
-
-static void smx_ctx_lua_suspend(smx_context_t context)
-{
- int rv;
- INFO1("Suspending %s",context->argv[0]);
- lua_yield(((smx_ctx_lua_t)context)->state,0); // Should be the last line of the function
- smx_ctx_lua_t prev_context = ((smx_ctx_lua_t) context)->prev;
-
- ((smx_ctx_lua_t) context)->prev = NULL;
-
- rv = swapcontext(&((smx_ctx_lua_t) context)->uc, &prev_context->uc);
+static void smx_ctx_lua_suspend(smx_context_t pcontext) {
+ smx_ctx_lua_t context = (smx_ctx_lua_t)pcontext;
+ DEBUG1("Suspending '%s' (using sysv facilities)",context->super.super.argv[0]);
+ smx_ctx_sysv_suspend(pcontext);