2005-10-07 06:40:59 +02:00
|
|
|
#ifndef TIMEOUT_H
|
|
|
|
#define TIMEOUT_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$
|
|
|
|
\*=========================================================================*/
|
2005-09-29 08:11:42 +02:00
|
|
|
#include "lua.h"
|
2003-05-25 03:54:13 +02:00
|
|
|
|
|
|
|
/* timeout control structure */
|
2005-10-07 06:40:59 +02:00
|
|
|
typedef struct t_timeout_ {
|
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 */
|
2005-10-07 06:40:59 +02:00
|
|
|
} t_timeout;
|
|
|
|
typedef t_timeout *p_timeout;
|
2002-07-03 21:06:54 +02:00
|
|
|
|
2005-10-07 06:40:59 +02:00
|
|
|
int timeout_open(lua_State *L);
|
|
|
|
void timeout_init(p_timeout tm, double block, double total);
|
|
|
|
double timeout_get(p_timeout tm);
|
|
|
|
double timeout_getretry(p_timeout tm);
|
|
|
|
p_timeout timeout_markstart(p_timeout tm);
|
|
|
|
double timeout_getstart(p_timeout tm);
|
|
|
|
double timeout_gettime(void);
|
|
|
|
int timeout_meth_settimeout(lua_State *L, p_timeout tm);
|
2002-07-03 21:06:54 +02:00
|
|
|
|
2005-10-07 06:40:59 +02:00
|
|
|
#define timeout_iszero(tm) ((tm)->block == 0.0)
|
2004-07-15 08:11:53 +02:00
|
|
|
|
2005-10-07 06:40:59 +02:00
|
|
|
#endif /* TIMEOUT_H */
|