From addda418ec6c46e0d9f16fa51d70ff19e6b63ec0 Mon Sep 17 00:00:00 2001 From: Michael Hunold Date: Sat, 31 Jan 2004 11:31:34 +0000 Subject: - add wait_event_interruptible_timeout() macro to dvb-compat.h - replace usage of sleep_on_interruptible_timeout() with wait_event_interruptible_timeout() --- linux/drivers/media/dvb/dvb-core/dvb_compat.h | 33 +++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'linux/drivers/media/dvb/dvb-core') diff --git a/linux/drivers/media/dvb/dvb-core/dvb_compat.h b/linux/drivers/media/dvb/dvb-core/dvb_compat.h index 5f25ec5b3..a390dfcea 100644 --- a/linux/drivers/media/dvb/dvb-core/dvb_compat.h +++ b/linux/drivers/media/dvb/dvb-core/dvb_compat.h @@ -8,6 +8,39 @@ #include #include +#ifndef wait_event_interruptible_timeout +#define __wait_event_interruptible_timeout(wq, condition, ret) \ +do { \ + wait_queue_t __wait; \ + init_waitqueue_entry(&__wait, current); \ + \ + add_wait_queue(&wq, &__wait); \ + for (;;) { \ + set_current_state(TASK_INTERRUPTIBLE); \ + if (condition) \ + break; \ + if (!signal_pending(current)) { \ + ret = schedule_timeout(ret); \ + if (!ret) \ + break; \ + continue; \ + } \ + ret = -ERESTARTSYS; \ + break; \ + } \ + current->state = TASK_RUNNING; \ + remove_wait_queue(&wq, &__wait); \ +} while (0) + +#define wait_event_interruptible_timeout(wq, condition, timeout) \ +({ \ + long __ret = timeout; \ + if (!(condition)) \ + __wait_event_interruptible_timeout(wq, condition, __ret); \ + __ret; \ +}) +#endif + #ifndef VIDEO_AUDIO_BALANCE #define VIDEO_AUDIO_BALANCE 32 #endif -- cgit v1.2.3