6 Star 1 Fork 0

wudizhanshen66/花生酱

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
timer.h 686 Bytes
一键复制 编辑 原始数据 按行查看 历史
wudizhanshen66 提交于 2024-05-14 16:52 . 3期所有,4期超时断开
#ifndef _TIMER_H
#define _TIMER_H
#include "thread_pool.h"
#define TIME_NUM 60
struct node{
int uid; // 用户id
int peerfd; // 连接
struct node* next;
};
struct slot{
int size; // 结点的连接个数
struct node* head; // 结点链表
};
typedef struct time_queue{
struct slot slot[TIME_NUM]; // 循环队列
int current_index; // 当前指针
}Time_Queue;
Time_Queue* time_queue_init();
void time_queue_destroy(Time_Queue* queue);
void move_next(Time_Queue* queue);
void update_node(Time_Queue* queue, int uid, int peerfd);
void insert_node(Time_Queue* queue, int uid, int peerfd);
#endif
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/wudizhanshen66/peanut.git
git@gitee.com:wudizhanshen66/peanut.git
wudizhanshen66
peanut
花生酱
master

搜索帮助