|
1 #ifndef TIMEOUT_H |
|
2 #define TIMEOUT_H |
|
3 /*=========================================================================*\ |
|
4 * LuaSocket 2.0.2 |
|
5 * Copyright (C) 2004-2007 Diego Nehab |
|
6 * |
|
7 * Timeout management functions |
|
8 * |
|
9 * RCS ID: $Id: timeout.h 2 2006-04-30 19:30:47Z brunoos $ |
|
10 \*=========================================================================*/ |
|
11 #include <lua.h> |
|
12 |
|
13 /* timeout control structure */ |
|
14 typedef struct t_timeout_ { |
|
15 double block; /* maximum time for blocking calls */ |
|
16 double total; /* total number of miliseconds for operation */ |
|
17 double start; /* time of start of operation */ |
|
18 } t_timeout; |
|
19 typedef t_timeout *p_timeout; |
|
20 |
|
21 int timeout_open(lua_State *L); |
|
22 void timeout_init(p_timeout tm, double block, double total); |
|
23 double timeout_get(p_timeout tm); |
|
24 double timeout_getretry(p_timeout tm); |
|
25 p_timeout timeout_markstart(p_timeout tm); |
|
26 double timeout_getstart(p_timeout tm); |
|
27 double timeout_gettime(void); |
|
28 int timeout_meth_settimeout(lua_State *L, p_timeout tm); |
|
29 |
|
30 #define timeout_iszero(tm) ((tm)->block == 0.0) |
|
31 |
|
32 #endif /* TIMEOUT_H */ |