poll_wait第二次返回没有wake_up调用

时间:2017-12-29 17:44:35

标签: polling

申请:

fd = open("/dev/ch_ar_dev", O_RDWR); 

ufd.fd = fd; 
ufd.events= POLLIN; 
ufd.revents= 0;

循环4次:

pollret = poll(&ufd,1,-1); 
read(fd, read_buf, sizeof(read_buf));

模块:

unsigned int polldev(-,-) { 
unsigned int mask = 0; 
if (data_avail_to_read) mask |= POLLIN | POLLRDNORM; 
poll_wait(filp, &waitqueue, wait); 
return mask; } 

ssize_t readdev(-, -, -) { unsigned long ret; printk("Inside read \n"); 
ret = copy_to_user(buff, &kPressed, count); return ret; } 

ISR:

data_avail_to_read = 1; 
wake_up(&waitqueue);

我通过wake_up()从ISR触发了poll_wait()。每次调用poll()时,无论poll()被设置为无限期等待,它都会返回而不会被wake_up触发。可能是什么原因?

0 个答案:

没有答案