2#include "lockfree_list.hpp"
13 handle->
data_.cycle_ = cycle;
28 ASSERT(!handle->
next_);
33#ifdef LIBXR_NOT_SUPPORT_MUTI_THREAD
48#ifndef LIBXR_NOT_SUPPORT_MUTI_THREAD
50 auto thread_handle =
Thread();
65 if (block.count_ >= block.cycle_)
std::atomic< BaseNode * > next_
指向下一个节点的原子指针。 Atomic pointer to the next node.
数据节点模板,继承自 BaseNode,用于存储具体数据类型。 Template data node that inherits from BaseNode to store specific data...
Data data_
存储的数据。 The stored data.
链表实现,用于存储和管理数据节点。 A linked list implementation for storing and managing data nodes.
ErrorCode Foreach(Func func)
遍历链表中的每个节点,并应用回调函数。 Iterates over each node in the list and applies a callback function.
void Add(BaseNode &data)
向链表添加一个节点。 Adds a node to the linked list.
表示毫秒级时间戳的类。Class representing a timestamp in milliseconds.
线程管理类,封装 POSIX 线程创建和调度 Thread management class encapsulating POSIX thread creation and scheduling
static uint32_t GetTime()
获取当前系统时间(毫秒) Gets the current system time in milliseconds
static void SleepUntil(MillisecondTimestamp &last_waskup_time, uint32_t time_to_sleep)
让线程休眠直到指定时间点 Puts the thread to sleep until a specified time
void Create(ArgType arg, void(*function)(ArgType arg), const char *name, size_t stack_depth, Thread::Priority priority)
创建新线程 Creates a new thread
控制块类,存储任务信息 Control block class for storing task information
static Thread thread_handle_
定时器管理线程 Timer management thread
static uint32_t stack_depth_
线程栈深度 Thread stack depth
static LibXR::Thread::Priority priority_
线程优先级 Thread priority
static void RefreshThreadFunction(void *)
定时器管理线程函数 Timer management thread function
static void Refresh()
刷新定时任务状态 Refreshes the state of periodic tasks
static void SetCycle(TimerHandle handle, uint32_t cycle)
设置定时任务的周期 Sets the cycle of a periodic task
static void Start(TimerHandle handle)
启动定时任务 Starts a periodic task
static void Add(TimerHandle handle)
添加定时任务 Adds a periodic task
static LibXR::LockFreeList * list_
定时任务列表 List of registered tasks
static void Stop(TimerHandle handle)
停止定时任务 Stops a periodic task