TDengine/include/util/ttimer.h

52 lines
1.4 KiB
C
Raw Normal View History

2019-07-11 08:36:16 +00:00
/*
* 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/>.
*/
2021-10-04 12:42:53 +00:00
#ifndef _TD_UTIL_TIMER_H
#define _TD_UTIL_TIMER_H
2019-07-11 08:36:16 +00:00
#ifdef __cplusplus
extern "C" {
#endif
typedef void *tmr_h;
2019-11-08 02:48:43 +00:00
typedef void (*TAOS_TMR_CALLBACK)(void *, void *);
2019-07-11 08:36:16 +00:00
2019-11-08 02:48:43 +00:00
extern int taosTmrThreads;
2020-06-23 03:22:35 +00:00
extern uint32_t tsMaxTmrCtrl;
2019-07-11 08:36:16 +00:00
#define MSECONDS_PER_TICK 5
2019-11-08 02:48:43 +00:00
void *taosTmrInit(int maxTmr, int resoultion, int longest, const char *label);
2019-07-11 08:36:16 +00:00
2019-11-08 02:48:43 +00:00
tmr_h taosTmrStart(TAOS_TMR_CALLBACK fp, int mseconds, void *param, void *handle);
2019-07-11 08:36:16 +00:00
2019-11-08 02:48:43 +00:00
bool taosTmrStop(tmr_h tmrId);
2019-11-07 10:12:26 +00:00
2019-11-08 02:48:43 +00:00
bool taosTmrStopA(tmr_h *timerId);
2019-07-11 08:36:16 +00:00
2019-11-08 02:48:43 +00:00
bool taosTmrReset(TAOS_TMR_CALLBACK fp, int mseconds, void *param, void *handle, tmr_h *pTmrId);
2019-07-11 08:36:16 +00:00
void taosTmrCleanUp(void *handle);
2020-05-07 10:26:19 +00:00
int32_t taosInitTimer(void (*callback)(int), int32_t ms);
void taosUninitTimer();
2019-07-11 08:36:16 +00:00
#ifdef __cplusplus
}
#endif
2021-10-04 12:42:53 +00:00
#endif /*_TD_UTIL_TIMER_H*/