1. 功能:创建以个等待队列头

2. 函数原型
#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 } }
 
typedef struct __wait_queue_head wait_queue_head_t ;
struct __wait_queue_head {
    spinlock_t lock;
    struct list_head task_list;
};
 
3. 使用示例:
010_Linux驱动之_DECLARE_WAIT_QUEUE_HEAD函数

 

解析上面程序:

1. 创建一个名字叫button_waitq的等待队列头
2. 名字任意
010_Linux驱动之_DECLARE_WAIT_QUEUE_HEAD函数