TDengine/include/util/ttimer.h

49 lines
1.3 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/>.
*/
2022-02-28 06:28:42 +00:00
#ifndef _TD_UTIL_TIMER_H_
#define _TD_UTIL_TIMER_H_
2019-07-11 08:36:16 +00:00
2021-12-21 12:07:32 +00:00
#include "os.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
2022-02-28 06:28:42 +00:00
extern int32_t taosTmrThreads;
2019-07-11 08:36:16 +00:00
#define MSECONDS_PER_TICK 5
2022-02-28 06:28:42 +00:00
void *taosTmrInit(int32_t maxTmr, int32_t resoultion, int32_t longest, const char *label);
2019-07-11 08:36:16 +00:00
2022-06-01 11:57:03 +00:00
void taosTmrCleanUp(void *handle);
2022-02-28 06:28:42 +00:00
tmr_h taosTmrStart(TAOS_TMR_CALLBACK fp, int32_t 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
2022-06-01 12:03:01 +00:00
bool taosTmrStopA(tmr_h *tmrId);
2022-02-28 06:28:42 +00:00
bool taosTmrReset(TAOS_TMR_CALLBACK fp, int32_t mseconds, void *param, void *handle, tmr_h *pTmrId);
2019-07-11 08:36:16 +00:00
#ifdef __cplusplus
}
#endif
2022-02-28 06:28:42 +00:00
#endif /*_TD_UTIL_TIMER_H_*/