diff options
Diffstat (limited to 'Build/source/texk/web2c/luatexdir/luasocket/src/timeout.c')
-rw-r--r-- | Build/source/texk/web2c/luatexdir/luasocket/src/timeout.c | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/Build/source/texk/web2c/luatexdir/luasocket/src/timeout.c b/Build/source/texk/web2c/luatexdir/luasocket/src/timeout.c index c7354b52f38..5a601d5410a 100644 --- a/Build/source/texk/web2c/luatexdir/luasocket/src/timeout.c +++ b/Build/source/texk/web2c/luatexdir/luasocket/src/timeout.c @@ -8,6 +8,7 @@ #include "lua.h" #include "lauxlib.h" +#include "compat.h" #include "auxiliar.h" #include "timeout.h" @@ -52,7 +53,7 @@ void timeout_init(p_timeout tm, double block, double total) { /*-------------------------------------------------------------------------*\ * Determines how much time we have left for the next system call, -* if the previous call was successful +* if the previous call was successful * Input * tm: timeout control structure * Returns @@ -107,7 +108,7 @@ double timeout_getretry(p_timeout tm) { } /*-------------------------------------------------------------------------*\ -* Marks the operation start time in structure +* Marks the operation start time in structure * Input * tm: timeout control structure \*-------------------------------------------------------------------------*/ @@ -117,7 +118,7 @@ p_timeout timeout_markstart(p_timeout tm) { } /*-------------------------------------------------------------------------*\ -* Gets time in s, relative to January 1, 1970 (UTC) +* Gets time in s, relative to January 1, 1970 (UTC) * Returns * time in s. \*-------------------------------------------------------------------------*/ @@ -144,7 +145,7 @@ double timeout_gettime(void) { * Initializes module \*-------------------------------------------------------------------------*/ int timeout_open(lua_State *L) { - luaL_openlib(L, NULL, func, 0); + luaL_setfuncs(L, func, 0); return 0; } @@ -159,7 +160,7 @@ int timeout_meth_settimeout(lua_State *L, p_timeout tm) { const char *mode = luaL_optstring(L, 3, "b"); switch (*mode) { case 'b': - tm->block = t; + tm->block = t; break; case 'r': case 't': tm->total = t; @@ -172,6 +173,16 @@ int timeout_meth_settimeout(lua_State *L, p_timeout tm) { return 1; } +/*-------------------------------------------------------------------------*\ +* Gets timeout values for IO operations +* Lua Output: block, total +\*-------------------------------------------------------------------------*/ +int timeout_meth_gettimeout(lua_State *L, p_timeout tm) { + lua_pushnumber(L, tm->block); + lua_pushnumber(L, tm->total); + return 2; +} + /*=========================================================================*\ * Test support functions \*=========================================================================*/ |