ttimer.h 1.3 KB
Newer Older
H
hzcheng 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
/*
 * Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
 *
 * This program is free software: you can use, redistribute, and/or modify
 * it under the terms of the GNU Affero General Public License, version 3
 * or later ("AGPL"), as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 */

S
timer  
Shengliang Guan 已提交
16 17
#ifndef _TD_UTIL_TIMER_H_
#define _TD_UTIL_TIMER_H_
H
hzcheng 已提交
18

L
Liu Jicong 已提交
19 20
#include "os.h"

H
hzcheng 已提交
21 22 23 24 25
#ifdef __cplusplus
extern "C" {
#endif

typedef void *tmr_h;
weixin_48148422's avatar
weixin_48148422 已提交
26
typedef void (*TAOS_TMR_CALLBACK)(void *, void *);
H
hzcheng 已提交
27

S
timer  
Shengliang Guan 已提交
28
extern int32_t taosTmrThreads;
H
hzcheng 已提交
29

S
slguan 已提交
30 31
#define MSECONDS_PER_TICK 5

S
timer  
Shengliang Guan 已提交
32
void *taosTmrInit(int32_t maxTmr, int32_t resoultion, int32_t longest, const char *label);
H
hzcheng 已提交
33

S
timer  
Shengliang Guan 已提交
34
tmr_h taosTmrStart(TAOS_TMR_CALLBACK fp, int32_t mseconds, void *param, void *handle);
H
hzcheng 已提交
35

weixin_48148422's avatar
weixin_48148422 已提交
36
bool taosTmrStop(tmr_h tmrId);
S
slguan 已提交
37

weixin_48148422's avatar
weixin_48148422 已提交
38
bool taosTmrStopA(tmr_h *timerId);
H
hzcheng 已提交
39

S
timer  
Shengliang Guan 已提交
40
bool taosTmrReset(TAOS_TMR_CALLBACK fp, int32_t mseconds, void *param, void *handle, tmr_h *pTmrId);
H
hzcheng 已提交
41 42 43 44 45 46 47

void taosTmrCleanUp(void *handle);

#ifdef __cplusplus
}
#endif

S
timer  
Shengliang Guan 已提交
48
#endif /*_TD_UTIL_TIMER_H_*/