当前位置:网站首页>DECLARE_ WAIT_ QUEUE_ HEAD、wake_ up_ Interruptible macro analysis
DECLARE_ WAIT_ QUEUE_ HEAD、wake_ up_ Interruptible macro analysis
2022-07-05 03:13:00 【_ Zer0】
DECLARE_WAIT_QUEUE_HEAD
// Source code
struct list_head {
struct list_head *next, *prev;
};
struct __wait_queue_head {
spinlock_t lock;
struct list_head task_list;
};
typedef struct __wait_queue_head wait_queue_head_t;
#define DECLARE_WAIT_QUEUE_HEAD (name)
wait_queue_head_t name = __WAIT_QUEUE_HEAD_INITIALIZER(name)
#define __WAIT_QUEUE_HEAD_INITIALIZER (name) {
.lock = __SPIN_LOCK_UNLOCKED(name.lock),
.task_list = {
&(name).task_list, &(name).task_list }
}
//DECLARE_WAIT_QUEUE_HEAD(wq); The result of unlocking the macro definition statement is as follows
wait_queue_head_t wq = {
.lock = __SPIN_LOCK_UNLOCKED(wq.lock),
.task_list = {
&(wq).task_list, &(wq).task_list }
}
#include <linux/wait.h>
// The following two lines are equivalent to DECLARE_WAIT_QUEUE_HEAD(wq);
wait_queue_head_t wq;
init_waitqueue_head(&wq);
wake_up_interruptible
#define wake_up_interruptible(x) __wake_up(x, TASK_INTERRUPTIBLE, 1, NULL)
void __wake_up(wait_queue_head_t *q, unsigned int mode,
int nr_exclusive, void *key)
{
unsigned long flags;
spin_lock_irqsave(&q->lock, flags);
__wake_up_common(q, mode, nr_exclusive, 0, key);
spin_unlock_irqrestore(&q->lock, flags);
}
边栏推荐
- Why is this an undefined behavior- Why is this an undefined behavior?
- qrcode:将文本生成二维码
- Azkaban概述
- Voice chip wt2003h4 B008 single chip to realize the quick design of intelligent doorbell scheme
- Acwing第 58 场周赛【完结】
- Single box check box
- Comparison of advantages and disadvantages between platform entry and independent deployment
- The perfect car for successful people: BMW X7! Superior performance, excellent comfort and safety
- SFTP cannot connect to the server # yyds dry goods inventory #
- Bumblebee: build, deliver, and run ebpf programs smoothly like silk
猜你喜欢
Share the newly released web application development framework based on blazor Technology
Azkaban实战
TCP security of network security foundation
Elk log analysis system
Azkaban installation and deployment
ELFK部署
Simple use of devtools
How to learn to get the embedding matrix e # yyds dry goods inventory #
Acwing game 58 [End]
Azkaban overview
随机推荐
The perfect car for successful people: BMW X7! Superior performance, excellent comfort and safety
El tree whether leaf node or not, the drop-down button is permanent
Character painting, I use characters to draw a Bing Dwen Dwen
ELFK部署
In MySQL Association query, the foreign key is null. What if the data cannot be found?
LeetCode --- 1071. Great common divisor of strings problem solving Report
el-select,el-option下拉选择框
Why are there fewer and fewer good products produced by big Internet companies such as Tencent and Alibaba?
When sqlacodegen generates a model, how to solve the problem that the password contains special characters?
Kubernetes - identity and authority authentication
Spark SQL learning bullet 2
Single box check box
The perfect car for successful people: BMW X7! Superior performance, excellent comfort and safety
Zabbix
问下,这个ADB mysql支持sqlserver吗?
Design and implementation of campus epidemic prevention and control system based on SSM
为什么腾讯阿里等互联网大厂诞生的好产品越来越少?
LeetCode 234. Palindrome linked list
Flume配置4——自定义MYSQLSource
8. Commodity management - commodity classification