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
|
|
|
\*=========================================================================*/
|
2019-02-28 05:01:16 +01:00
|
|
|
#include "luasocket.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
|
|
|
|
2019-03-01 00:32:07 +01:00
|
|
|
#ifndef _WIN32
|
2019-02-28 05:01:16 +01:00
|
|
|
#pragma GCC visibility push(hidden)
|
2019-03-01 00:32:07 +01:00
|
|
|
#endif
|
2019-02-28 05:01:16 +01:00
|
|
|
|
2005-10-07 06:40:59 +02:00
|
|
|
void timeout_init(p_timeout tm, double block, double total);
|
|
|
|
double timeout_get(p_timeout tm);
|
2019-02-28 05:01:16 +01:00
|
|
|
double timeout_getstart(p_timeout tm);
|
2005-10-07 06:40:59 +02:00
|
|
|
double timeout_getretry(p_timeout tm);
|
|
|
|
p_timeout timeout_markstart(p_timeout tm);
|
2019-02-28 05:01:16 +01:00
|
|
|
|
2005-10-07 06:40:59 +02:00
|
|
|
double timeout_gettime(void);
|
2019-02-28 05:01:16 +01:00
|
|
|
|
|
|
|
int timeout_open(lua_State *L);
|
|
|
|
|
2005-10-07 06:40:59 +02:00
|
|
|
int timeout_meth_settimeout(lua_State *L, p_timeout tm);
|
2016-03-04 19:36:32 +01:00
|
|
|
int timeout_meth_gettimeout(lua_State *L, p_timeout tm);
|
2002-07-03 21:06:54 +02:00
|
|
|
|
2019-03-01 00:32:07 +01:00
|
|
|
#ifndef _WIN32
|
2019-02-28 05:01:16 +01:00
|
|
|
#pragma GCC visibility pop
|
2019-03-01 00:32:07 +01:00
|
|
|
#endif
|
2019-02-28 05:01:16 +01: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 */
|