2) 如果要被wait_event_interruptible的当前进程有nonblocked pending signals, 那么会直接返回-ERESTARTSYS(i.e. -512),当前进程不会 被wait_event_interruptible 和从runqueue队列中删除。 3) 其他情况下,当前进程会被正常的wait_event_interruptible,并从 runqueue队列中删除,进入TASK_INTERRUPTIBLE状态退出运行调度,...
问题剖析 根据返回值找到了-512其实就是-ERESTARTSYS,本着...Linux kernel 5.x wait_event_interruptible_timeout() 先看看内核源码的注释,这往往是在研究内核函数必读的一段文字,这将会给我们理解内核代码执行逻辑带来很大的帮助,一定要花时间好好理解; 函数在内核代码被定义为一个宏: /** wait_event_...
If two readers simultaneously check your code, they may both findatomic_read(&data_sz) >=512to be true. Consequently, the second reader would performatomic_xchg(&data_sz,-1)withdata_szbeing equal to-1. To ensure that the condition cannot be divided, you can safeguard its assessment using...
2) 如果要被wait_event_interruptible的当前进程有nonblocked pending signals, 那么会直接返回-ERESTARTSYS(i.e. -512),当前进程不会 被wait_event_interruptible 和从runqueue队列中删除。 3) 其他情况下,当前进程会被正常的wait_event_interruptible,并从 runqueue队列中删除,进入TASK_INTERRUPTIBLE状态退出运行调度,...