LIBKYTIMER(3)

NAME
libkytimer - KYSDK C语言定时器模块

SYNOPSIS

  Classes

  Typedefs
typedef void *(* time_handler) (void *user_data)
typedef struct _KTimerNode KTimerNode

  Enumerations
enum KTimerAttribute { KTIMER_SINGLESHOT = 0, KTIMER_PERIODIC = 1, KTIMER_NEVER = 2 }
enum KTimerType { KTIMER_ABSOLUTE = 0, KTIMER_RELATIVE }

  Functions
int kdk_timer_init ()
初始化定时器核心组件
size_t kdk_timer_start (unsigned int intervalms, time_handler callback, KTimerAttribute attr, KTimerType type, void *userdata, int freeOnDelete)
启动一个定时器
void kdk_timer_stop (size_t timerfd)
停止给定的定时器
void kdk_timer_reset (size_t timerfd, unsigned int intervalms)
重置定时器时间至intervalms，以毫秒为单位
void kdk_timer_destroy ()
销毁定时器核心

DATA STRUCTURES
typedef struct _KTimerNode {
    pthread_mutex_t    lock;
    size_t    fd;    //序列号
    time_handler    callback;    //到期后执行的函数
    int    freeOnDelete;    //删除定时器时自动释放userdata
    void*    userdata;    //callback使用的参数，外部使用alloc分配内存，在delete定时器的时候会根据配置自动释放
    unsigned int    intervalms;    //定时器间隔时间，单位毫秒
    KTimerAttribute    attr;    //触发类型，单次触发或多次触发
    KTimerType    type;    //时钟类型，绝对时间还是相对时间
    struct _KTimerNode*    next;
} KTimerNode; There are other members not documented here, which are only meant for libkytimer internal use.

Detailed Description

KYSDK C语言定时器模块

CONFORMING TO
These functions are as per the withdrawn POSIX.1e draft specification. The following functions are Linux extensions: kdk_timer_init(), kdk_timer_start(), kdk_timer_stop(), kdk_timer_reset() and kdk_timer_destroy().

SEE ALSO
kdk_timer_init(3), kdk_timer_start(3), kdk_timer_stop(3), kdk_timer_reset(3) and kdk_timer_destroy(3).

Author

Generated automatically by Doxygen for libkytimer.h from the source code.