- 博客(3)
- 收藏
- 关注
原创 使用gcc内置CAS函数实现spinlock
gcc 里提供了内置 CAS 函数:__atomic_compare_exchange_n(),它的基本用法如下:Built-in Function:bool__atomic_compare_exchange_n(type*ptr,type*expected,typedesired, bool weak, int success_memorder, int failure_memorder)This built-in function implements an a...
2021-08-18 08:48:25 1490
原创 从内核patch看epoll中的边沿触发
在 epoll 的 man 手册里其实并没有对边沿触发有一个特别清晰和明确的定义,作者也只是举了一个例子来阐述边沿触发的表现,在使用的时候还需要根据具体实现去测试它的行为。 在 man 手册里,作者列举了这样一个场景:1. The file descriptor that represents the read side of a pipe (rfd) is registered on the epoll instance.2. A pipe...
2021-08-15 10:18:33 106
原创 使用fifo文件实现进程间通信
fifo 文件是一种先进先出的特殊文件,即命名管道。从man7 上可以看到 fifo 的相关信息,摘抄如下:A FIFO special file (a named pipe) is similar to a pipe, except that it is accessed as part of the filesystem. It can be opened by multiple processes for reading or w...
2021-08-08 09:18:16 1051
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人