Messages in this thread | | | Date | Sat, 23 Jan 1999 14:05:15 +0000 (GMT) | From | Tim Waugh <> | Subject | down_interruptible and timers |
| |
Here's a code snippet from a module I'm compiling against the 2.2.0-pre9 source:
if (ecrval & 0x02) { /* FIFO is full. Wait for interrupt. */ outb (ecrval & ~(1<<2), ecr); /* serviceIntr */ false_alarm: timer.expires = jiffies + HZ; timer.data = (unsigned long) port; timer.function = (timer_fn) parport_ieee1284_wakeup; add_timer (&timer);
printk (KERN_DEBUG "down_interruptible returned %d\n", down_interruptible (&port->ieee1284.sem));
del_timer (&timer);
if (signal_pending (current)) { printk (KERN_DEBUG "Signal pending\n"); break; }
printk (KERN_DEBUG "No signal pending\n"); if (!time_before (jiffies, expire)) { /* Timed out. */ printk (KERN_DEBUG "Timed out\n"); break; }
ecrval = inb (ecr); if (!(ecrval & (1<<2))) goto false_alarm; continue; }
parport_ieee1284_wakeup is a function that calls up(&port->ieee1284.sem), although it will never get called in this example. I'm expecting down_interruptible to sleep for one second at a time. The semaphore is initialised to 0. This code is supposed to give up after five seconds.
What actually happens is this: the first time I hit this code, the machine freezes for five seconds. down_interruptible returns zero and no signal is pending. Presumably down_interruptible returns immediately, since no other processes are getting scheduled.
I kill the process, and down_interruptible returns -EINTR. I try again. This time, down_interruptible doesn't return. Not after one second, not after five seconds, and not after a minute.
This code worked fine in pre7, I'm sure of it. I'll do more testing later.
Can anyone shed any light on this?
Tim. */
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/
| |