Files
Linux-C-Notes/C16-并发/parallel/signal/anytimer/anytimer.h
2024-05-27 02:33:10 +08:00

47 lines
1.4 KiB
C
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#ifndef __ANYTIMER__H__
#define __ANYTIMER__H__
#define JOB_MAX 1024
typedef void at_jobfunc_t(void *);
/********************************************************************
* @brief 创建定时器
* @details
* @param sec
* @param jobp
* @param arg
* @return int
* >= 0 成功返回定时器ID
* == -EINVAL 失败,参数错误
* == -ENOMEM 失败,内存不足
* == -ENOSPC 失败,数组满
********************************************************************/
int at_addjob(int sec, at_jobfunc_t *jobp, void *arg);
/********************************************************************
* @brief 取消定时器
* @details
* @param id
* @return int
* == 0 成功,定时器已取消
* == -EINVAL 失败,参数错误
* == -EBUSY 失败,指定任务已完成
* == -ECANCELED 失败,定时器重复取消
********************************************************************/
int at_canceljob(int id);
/*********************************************************************
* @brief 回收任务
* @details
* @param id
* @return int
* == 0 成功,任务已回收
* == -EINVAL 失败,参数错误
********************************************************************/
int at_waitjob(int id);
int at_pausejob(int id);
int at_resumejob(int id);
#endif //!__ANYTIMER__H__