Re: down_timeout

From: Andrew Morton
Date: Fri Oct 03 2003 - 15:37:34 EST


Matthew Wilcox <willy@xxxxxxxxxx> wrote:
>
> /* Returns -EINTR if the timeout expires */
> int down_timeout(struct semaphore *sem, long timeout)
> {
> struct timer_list timer;
> int result;
>
> init_timer(&timer);
> timer.expires = timeout + jiffies;
> timer.data = (unsigned long) current;
> timer.function = process_timeout;
>
> add_timer(&timer);
> result = down_interruptible(sem);
> del_timer_sync(&timer);
>
> return result;
> }

down_interruptible() will only break out if signal_pending(current), so the
wakeup-on-expiry here will not work as desired.

New per-arch primitives would be needed to implement this, I think.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/