beta-0.89.2
[luatex.git] / source / texk / web2c / luatexdir / luasocket / src / timeout.h
blob6715ca70a1b52037939aa716ee16df2b8cb85dff
1 #ifndef TIMEOUT_H
2 #define TIMEOUT_H
3 /*=========================================================================*\
4 * Timeout management functions
5 * LuaSocket toolkit
6 \*=========================================================================*/
7 #include "lua.h"
9 /* timeout control structure */
10 typedef struct t_timeout_ {
11 double block; /* maximum time for blocking calls */
12 double total; /* total number of miliseconds for operation */
13 double start; /* time of start of operation */
14 } t_timeout;
15 typedef t_timeout *p_timeout;
17 int timeout_open(lua_State *L);
18 void timeout_init(p_timeout tm, double block, double total);
19 double timeout_get(p_timeout tm);
20 double timeout_getretry(p_timeout tm);
21 p_timeout timeout_markstart(p_timeout tm);
22 double timeout_getstart(p_timeout tm);
23 double timeout_gettime(void);
24 int timeout_meth_settimeout(lua_State *L, p_timeout tm);
26 #define timeout_iszero(tm) ((tm)->block == 0.0)
28 #endif /* TIMEOUT_H */