From: Christophe ThiƩry Date: Fri, 13 Jan 2012 15:22:52 +0000 (+0100) Subject: Lua: forgot the timeout argument of simgrid.comm.send X-Git-Tag: exp_20120216~129 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/a2db6875e060904db6e80684eb50ce2acba17dfc?hp=8ba5ebec745c34478bd1082a07edcb76aab3aefb Lua: forgot the timeout argument of simgrid.comm.send --- diff --git a/src/bindings/lua/lua_task.c b/src/bindings/lua/lua_task.c index 751289047d..cfdf114880 100644 --- a/src/bindings/lua/lua_task.c +++ b/src/bindings/lua/lua_task.c @@ -226,6 +226,7 @@ static void task_copy_callback(m_task_t task, m_process_t src_process, * - Argument 1 (task): the task to send * - Argument 2 (string or compatible): mailbox name, as a real string or any * type convertible to string (numbers always are) + * - Argument 3 (number, optional): timeout (default is no timeout) * - Return values (boolean + string): true if the communication was successful, * or false plus an error string in case of failure, which may be "timeout", * "host failure" or "transfer failure" @@ -234,12 +235,19 @@ static int l_task_send(lua_State* L) { m_task_t task = sglua_check_task(L, 1); const char* mailbox = luaL_checkstring(L, 2); - /* task mailbox ... */ + double timeout; + if (lua_gettop(L) >= 3) { + timeout = luaL_checknumber(L, 3); + } + else { + timeout = -1; + /* no timeout by default */ + } lua_settop(L, 1); /* task */ sglua_task_register(L); /* -- */ - MSG_error_t res = MSG_task_send(task, mailbox); + MSG_error_t res = MSG_task_send_with_timeout(task, mailbox, timeout); if (res == MSG_OK) { lua_pushboolean(L, 1); @@ -330,7 +338,7 @@ static int l_task_recv(lua_State* L) { m_task_t task = NULL; const char* mailbox = luaL_checkstring(L, 1); - int timeout; + double timeout; if (lua_gettop(L) >= 2) { /* mailbox timeout ... */ timeout = luaL_checknumber(L, 2);