- smx_ctx_lua_t context = (smx_ctx_lua_t)smx_ctx_sysv_create_context_sized
- (sizeof(s_smx_ctx_lua_t), code,argc,argv,cleanup_func,cleanup_arg);
-
-
- /* If the user provided a function for the process then use it
- otherwise is the context for maestro */
- if (code){
- INFO1("Created context for function %s",argv[0]);
-
- /* start the coroutine in charge of running that code */
- context->state = lua_newthread(lua_state);
- context->ref = luaL_ref(lua_state, LUA_REGISTRYINDEX); // protect the thread from being garbage collected
-
- /* Start the co-routine */
- lua_getglobal(context->state,context->super.super.argv[0]);
- xbt_assert1(lua_isfunction(context->state,-1),
- "The lua function %s does not seem to exist",context->super.super.argv[0]);
-
- // push arguments onto the stack
- int i;
- for(i=1;i<context->super.super.argc;i++)
- lua_pushstring(context->state,context->super.super.argv[i]);
-
- // Call the function (in resume)
- context->nargs = context->super.super.argc-1;
-
- } else {
- INFO0("Created context for maestro");
- }
-
- return (smx_context_t)context;
+ return smx_ctx_sysv_create_context_sized(sizeof(s_smx_ctx_sysv_t),
+ code,argc,argv,cleanup_func,cleanup_arg);