当前位置:网站首页>Random talk about redis source code onehundredandtwenty
Random talk about redis source code onehundredandtwenty
2022-06-22 20:05:00 【Tao song remains the same】
Use of mask , Really :
/*
* Helper function to invoke port_associate for the given fd and mask.
*/
static int aeApiAssociate(const char *where, int portfd, int fd, int mask) {
int events = 0;
int rv, err;
if (mask & AE_READABLE)
events |= POLLIN;
if (mask & AE_WRITABLE)
events |= POLLOUT;
if (evport_debug)
fprintf(stderr, "%s: port_associate(%d, 0x%x) = ", where, fd, events);
rv = port_associate(portfd, PORT_SOURCE_FD, fd, events,
(void *)(uintptr_t)mask);
err = errno;
if (evport_debug)
fprintf(stderr, "%d (%s)\n", rv, rv == 0 ? "no error" : strerror(err));
if (rv == -1) {
fprintf(stderr, "%s: port_associate: %s\n", where, strerror(err));
if (err == EAGAIN)
fprintf(stderr, "aeApiAssociate: event port limit exceeded.");
}
return rv;
}
static int aeApiAddEvent(aeEventLoop *eventLoop, int fd, int mask) {
aeApiState *state = eventLoop->apidata;
int fullmask, pfd;
if (evport_debug)
fprintf(stderr, "aeApiAddEvent: fd %d mask 0x%x\n", fd, mask);
/*
* Since port_associate's "events" argument replaces any existing events, we
* must be sure to include whatever events are already associated when
* we call port_associate() again.
*/
fullmask = mask | eventLoop->events[fd].mask;
pfd = aeApiLookupPending(state, fd);
if (pfd != -1) {
/*
* This fd was recently returned from aeApiPoll. It should be safe to
* assume that the consumer has processed that poll event, but we play
* it safer by simply updating pending_mask. The fd will be
* re-associated as usual when aeApiPoll is called again.
*/
if (evport_debug)
fprintf(stderr, "aeApiAddEvent: adding to pending fd %d\n", fd);
state->pending_masks[pfd] |= fullmask;
return 0;
}
return (aeApiAssociate("aeApiAddEvent", state->portfd, fd, fullmask));
}
边栏推荐
- 佐治亚理工学院|具有服务质量保证的多无人机野火协同覆盖和跟踪规划
- Summer Challenge [FFH] Hongmeng machine learning journey from scratch NLP emotion analysis
- Redis 大 key 问题
- C语言实现平衡二叉树
- 漫话Redis源码之一百一二十
- 插值查找和折半(二分)查找
- [deeply understand tcapulusdb technology] how to start tcapulusdb process
- R语言data.table导入数据实战:data.table数据列名称的重命名(rename)
- 0816 shortcomings of Feida (improvement direction)
- Matlab calling API
猜你喜欢

年中大促 | 集成无忧,超值套餐 6 折起

【深入理解TcaplusDB知识库】部署TcaplusDB Local版常见问题

1.2----- mechanical design tools (CAD software) and hardware design tools (EDA software) and comparison

不断重修的计划与变化

How to use yincan IS903 to master DIY's own USB flash disk? (good items for practicing BGA welding)

Modify the antd tree component so that its subclasses are arranged horizontally.
![[deeply understand tcapulusdb knowledge base] common problems in deploying tcapulusdb local](/img/2b/3ab5e247ac103728b4d3579c3c5468.png)
[deeply understand tcapulusdb knowledge base] common problems in deploying tcapulusdb local

【深入理解TcaplusDB技术】入门Tcaplus SQL Driver

使用 qrcodejs2 生成二维码详细API和参数

【深入理解TcaplusDB技术】入门TcaplusDB 问题汇总
随机推荐
B树代码(C语言)
[in depth understanding of tcaplus DB technology] Introduction to tcaplus JDBC development
阿波罗使用注意事项
Canvas picture frame
MySQL数据库基本操作
[in depth understanding of tcapulusdb technology] getting started with MySQL driver
[deeply understand tcapulusdb technology] tcapulusdb table management - modify table
#夏日挑战赛# 【FFH】从零开始的鸿蒙机器学习之旅-NLP情感分析
芯和半导体“射频EDA/滤波器设计平台”闪耀IMS2022
[in depth understanding of tcapulusdb technology] tcapulusdb adds a new business cluster cluster
How to use yincan IS903 to master DIY's own USB flash disk? (good items for practicing BGA welding)
北京大学|通过对比学习实现离线元强化学习的鲁棒任务表示
2. what is mechanical design?
[in depth understanding of tcapulusdb technology] tcapulusdb operation and maintenance doc
散列表(哈希表)
[in depth understanding of tcaplus DB technology] getting started tcaplus SQL driver
堆排序(原理加代码)
归并排序(递归和迭代实现)
matplotlib设置坐标轴刻度间隔
【深入理解TcaplusDB技术】TcaplusDB新增机型