ttimer.h 1.4 KB
Newer Older
H
hzcheng 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
/*
 * 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/>.
 */

#ifndef TDENGINE_TTIMER_H
#define TDENGINE_TTIMER_H

#ifdef __cplusplus
extern "C" {
#endif

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

weixin_48148422's avatar
weixin_48148422 已提交
26
extern int      taosTmrThreads;
S
Shengliang Guan 已提交
27
extern uint32_t tsMaxTmrCtrl;
H
hzcheng 已提交
28

S
slguan 已提交
29 30
#define MSECONDS_PER_TICK 5

weixin_48148422's avatar
weixin_48148422 已提交
31
void *taosTmrInit(int maxTmr, int resoultion, int longest, const char *label);
H
hzcheng 已提交
32

weixin_48148422's avatar
weixin_48148422 已提交
33
tmr_h taosTmrStart(TAOS_TMR_CALLBACK fp, int mseconds, void *param, void *handle);
H
hzcheng 已提交
34

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

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

weixin_48148422's avatar
weixin_48148422 已提交
39
bool taosTmrReset(TAOS_TMR_CALLBACK fp, int mseconds, void *param, void *handle, tmr_h *pTmrId);
H
hzcheng 已提交
40 41 42

void taosTmrCleanUp(void *handle);

H
hjxilinx 已提交
43 44 45 46
int32_t taosInitTimer(void (*callback)(int), int32_t ms);

void taosUninitTimer();

H
hzcheng 已提交
47 48 49 50 51
#ifdef __cplusplus
}
#endif

#endif  // TDENGINE_TTIMER_H