question on macros in wait.h
Quoted 4 lines
is there some deeper reason that there's no macro for waiting uninterruptablely with a timeout? Or did just nobody feel a need as yet?
Those macros seem to have moved out of <linux/sched.h> (2.4) and wait_event_interruptible_timeout() was added about 6 months ago; the changelog entry says it was for smbfs. So I'd guess "no need yet".
Here's an updated version of your patch, now using the same calling convention that the other two "can return 'early'" calls there provide. It's behaved in my testing, to replace the chaos in the usb synchronous call wrappers.
- Dave
include/linux/wait.h +26 -0
@@ -173,6 +173,32 @@ __ret; \ }) +#define __wait_event_timeout (wq, condition, ret) \ +do { \ + wait_queue_t __wait; \ + init_waitqueue_entry(&__wait, current); \ + \ + add_wait_queue(&wq, &__wait); \ + for (;;) { \ + set_current_state(TASK_UNINTERRUPTIBLE); \ + if (condition) \ + break; \ + ret = schedule_timeout(ret); \ + if (!ret) \ + break; \ + } \ + current->state = TASK_RUNNING; \ + remove_wait_queue(&wq, &__wait); \ +} while (0) + +#define wait_event_timeout (wq, condition, timeout) \ +({ \ + long __ret = timeout; \ + if (!(condition)) \ + __wait_event_timeout(wq, condition, __ret); \ + __ret; \ +}) +#define __wait_event_interruptible_timeout (wq, condition, ret) \ do { \ wait_queue_t __wait; \
Am Freitag, 21. März 2003 07:52 schrieb David Brownell:
Quoted 9 lines
Quoted 3 lines
is there some deeper reason that there's no macro for waiting uninterruptablely with a timeout? Or did just nobody feel a need as yet?
Those macros seem to have moved out of <
linux/sched.h> (2.4) andwait_event_interruptible_timeout()was added about 6 months ago; the changelog entry says it was for smbfs. So I'd guess "no need yet".
Quoted 4 lines
Here's an updated version of your patch, now using the same calling convention that the other two "can return 'early'" calls there provide. It's behaved in my testing, to replace the chaos in the usb synchronous call wrappers.
Much better than my version.
Regards
Oliver