2003-06-26 20:47:49 +02:00
|
|
|
#ifndef TM_H
|
|
|
|
#define TM_H
|
2003-03-28 22:08:50 +01:00
|
|
|
/*=========================================================================*\
|
|
|
|
* Timeout management functions
|
2003-06-26 20:47:49 +02:00
|
|
|
* LuaSocket toolkit
|
2003-03-28 22:08:50 +01:00
|
|
|
*
|
|
|
|
* RCS ID: $Id$
|
|
|
|
\*=========================================================================*/
|
2003-05-25 03:54:13 +02:00
|
|
|
#include <lua.h>
|
|
|
|
|
|
|
|
/* timeout control structure */
|
|
|
|
typedef struct t_tm_ {
|
2004-07-01 05:32:09 +02:00
|
|
|
double block; /* maximum time for blocking calls */
|
2005-03-11 03:21:27 +01:00
|
|
|
double total; /* total number of miliseconds for operation */
|
2004-07-01 05:32:09 +02:00
|
|
|
double start; /* time of start of operation */
|
2002-07-03 21:06:54 +02:00
|
|
|
} t_tm;
|
|
|
|
typedef t_tm *p_tm;
|
|
|
|
|
2004-02-04 15:29:11 +01:00
|
|
|
int tm_open(lua_State *L);
|
2004-07-01 05:32:09 +02:00
|
|
|
void tm_init(p_tm tm, double block, double total);
|
|
|
|
double tm_get(p_tm tm);
|
|
|
|
double tm_getretry(p_tm tm);
|
2004-01-21 19:40:52 +01:00
|
|
|
p_tm tm_markstart(p_tm tm);
|
2004-07-01 05:32:09 +02:00
|
|
|
double tm_getstart(p_tm tm);
|
|
|
|
double tm_gettime(void);
|
2003-08-16 02:06:04 +02:00
|
|
|
int tm_meth_settimeout(lua_State *L, p_tm tm);
|
2002-07-03 21:06:54 +02:00
|
|
|
|
2004-07-15 08:11:53 +02:00
|
|
|
#define tm_iszero(tm) ((tm)->block == 0.0)
|
|
|
|
|
2003-06-26 20:47:49 +02:00
|
|
|
#endif /* TM_H */
|