qt 里,read一个中断文件阻塞后,qtimer计时器停止了怎么办。
timer_up = new QTimer(this);
connect(timer_up , SIGNAL(timeout()) , this , SLOT(UpTimeOut()));
timer_up->start(100);
while(1)
{
int ret=read(fd_button,buff,sizeof(buff));
if(ret<0) printf("read button error");
for(i=0;i<4;i++)
if(49 == buff[i])
{
char sendback[16] = { 0x1 , '0' , '1' , 0x2 , i++ , 0x2 , 0x3 };
emit DisplayBack( sendback );
StopAudio();
PlayAudio(THANKS);
/* leds off */
for(int i=0;i<4;i++)
ioctl(fd_leds,1,i);
return ;
}
}
c c++
static ssize_t scc_read(struct file *filp,char *buffer,size_t count,loff_t *ppos)
{
unsigned long err;
if(!ev_press)
{
if(filp->f_flags & O_NONBLOCK)
return -EAGAIN;
else
wait_event_interruptible(button_waitq,ev_press);
}
ev_press = 0;
err=copy_to_user(buffer,(const void *)key_values,min(sizeof(key_values),count));
return err ? -EFAULT:min(sizeof(key_values),count);