/**
* \brief Ensures that a value in the stack is a valid task and returns it.
+ * A task is "valid" if the value in the stack at the given index is
+ * (a) a table
+ * (b) has a field called "__simgrid_task" which
+ * (c) contains the ctask itself (which can be typecast to msg_task_t*)
* \param L a Lua state
* \param index an index in the Lua stack
* \return the C task corresponding to this Lua task
}
/**
- * \brief Creates a new task and leaves it onto the stack.
+ * \brief Creates a new task and places it onto the stack.
* \param L a Lua state
* \return number of values returned to Lua
*
*
* A Lua task is a regular table with a full userdata inside, and both share
* the same metatable. For the regular table, the metatable allows OO-style
- * writing such as your_task:send(someone).
+ * writing such as your_task:send(someone) instead of your_task.send(your_task, someone)
* For the userdata, the metatable is used to check its type.
* TODO: make the task name an optional last parameter
*/
*/
static int l_task_execute(lua_State* L)
{
+ XBT_DEBUG("Called task_execute");
msg_task_t task = sglua_check_task(L, 1);
msg_error_t res = MSG_task_execute(task);
* \brief This function is called when a C task has just been copied.
*
* This callback is used to move the corresponding Lua task from the sender
- * process to the receiver process.
+ * process to the receiver process (so that the receiver can access and deal
+ * with it).
* It is executed in SIMIX kernel mode when the communication finishes,
* before both processes are awaken. Thus, this function is thread-safe when
* user processes are executed in parallel, though it modifies the Lua
}
/**
- * \brief Sends a task on a mailbox.
+ * \brief Sends a task to a mailbox.
* \param L a Lua state
* \return number of values returned to Lua
*