2019-02-25 20:35:38 +00:00
|
|
|
#ifndef WSFS_ADAPTER_TIME_TIMER_H
|
|
|
|
#define WSFS_ADAPTER_TIME_TIMER_H
|
2019-02-09 18:02:53 +00:00
|
|
|
|
2019-02-25 19:17:13 +00:00
|
|
|
#include "wsfs/adapter/time/timepoint.h"
|
2019-02-09 18:02:53 +00:00
|
|
|
|
|
|
|
struct wsfs_timer;
|
|
|
|
struct wsfs_timeout_manager;
|
|
|
|
|
|
|
|
typedef void wsfs_timer_timeout_fn(struct wsfs_timer * timer);
|
|
|
|
|
|
|
|
struct wsfs_timer
|
|
|
|
{
|
|
|
|
struct wsfs_timeout_manager * manager;
|
|
|
|
wsfs_timepoint timeout;
|
|
|
|
wsfs_timer_timeout_fn * timeout_handler;
|
|
|
|
void * user_data;
|
|
|
|
struct wsfs_timer * next;
|
|
|
|
struct wsfs_timer * prev;
|
|
|
|
};
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C"
|
|
|
|
{
|
|
|
|
#endif
|
|
|
|
|
|
|
|
extern void wsfs_timer_init(
|
|
|
|
struct wsfs_timer * timer,
|
|
|
|
struct wsfs_timeout_manager * manager);
|
|
|
|
|
|
|
|
extern void wsfs_timer_cleanup(
|
|
|
|
struct wsfs_timer * timer);
|
|
|
|
|
|
|
|
extern void wsfs_timer_start(
|
|
|
|
struct wsfs_timer * timer,
|
|
|
|
wsfs_timepoint absolute_timeout,
|
|
|
|
wsfs_timer_timeout_fn * handler,
|
|
|
|
void * user_data);
|
|
|
|
|
|
|
|
extern void wsfs_timer_cancel(
|
|
|
|
struct wsfs_timer * timer);
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|