当前位置:网站首页>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);
}
边栏推荐
- Usage scenarios and solutions of ledger sharing
- Design and implementation of campus epidemic prevention and control system based on SSM
- Comparison of advantages and disadvantages between platform entry and independent deployment
- SFTP cannot connect to the server # yyds dry goods inventory #
- Dart series: collection of best practices
- 問下,這個ADB mysql支持sqlserver嗎?
- Kubernetes - identity and authority authentication
- Pat grade a 1119 pre- and post order traversals (30 points)
- Ubantu disk expansion (VMware)
- Eight days of learning C language - while loop (embedded) (single chip microcomputer)
猜你喜欢
TCP security of network security foundation
Yyds dry goods inventory intelligent fan based on CC2530 design
Avoid material "minefields"! Play with super high conversion rate
Asp+access campus network goods trading platform
Yyds dry goods inventory embedded matrix
Class inheritance in C #
Bumblebee: build, deliver, and run ebpf programs smoothly like silk
Pat class a 1162 postfix expression
Sqoop installation
2021 Li Hongyi machine learning (3): what if neural network training fails
随机推荐
ELFK部署
Apache build web host
What is the most effective way to convert int to string- What is the most efficient way to convert an int to a String?
Spark SQL learning bullet 2
GFS distributed file system
040. (2.9) relieved
Devtools的簡單使用
Jd.com 2: how to prevent oversold in the deduction process of commodity inventory?
SFTP cannot connect to the server # yyds dry goods inventory #
Azkaban installation and deployment
Six stone programming: advantages of automated testing
Elfk deployment
2021 Li Hongyi machine learning (2): pytorch
Acwing第 58 场周赛【完结】
[105] Baidu brain map - Online mind mapping tool
【微服务|SCG】Filters的33种用法
Azkaban安装部署
1.五层网络模型
Kubernetes - identity and authority authentication
打破信息茧房-我主动获取信息的方法 -#3