X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=include%2Flinux%2Fwait.h;h=7f2eaaee7b421000e8aede0ca429818e73fa3e8b;hb=5e3b93f248c98873cc843e83092bb8da92ac85a2;hp=e51c6bba47e5e09f0e0a3c397cfd583e3aac9692;hpb=a91482bdcc2e0f6035702e46f1b99043a0893346;p=linux-2.6.git diff --git a/include/linux/wait.h b/include/linux/wait.h index e51c6bba4..7f2eaaee7 100644 --- a/include/linux/wait.h +++ b/include/linux/wait.h @@ -120,15 +120,18 @@ extern void FASTCALL(__wake_up_sync(wait_queue_head_t *q, unsigned int mode, int #define __wait_event(wq, condition) \ do { \ - DEFINE_WAIT(__wait); \ + wait_queue_t __wait; \ + init_waitqueue_entry(&__wait, current); \ \ + add_wait_queue(&wq, &__wait); \ for (;;) { \ - prepare_to_wait(&wq, &__wait, TASK_UNINTERRUPTIBLE); \ + set_current_state(TASK_UNINTERRUPTIBLE); \ if (condition) \ break; \ schedule(); \ } \ - finish_wait(&wq, &__wait); \ + current->state = TASK_RUNNING; \ + remove_wait_queue(&wq, &__wait); \ } while (0) #define wait_event(wq, condition) \ @@ -140,10 +143,12 @@ do { \ #define __wait_event_interruptible(wq, condition, ret) \ do { \ - DEFINE_WAIT(__wait); \ + wait_queue_t __wait; \ + init_waitqueue_entry(&__wait, current); \ \ + add_wait_queue(&wq, &__wait); \ for (;;) { \ - prepare_to_wait(&wq, &__wait, TASK_INTERRUPTIBLE); \ + set_current_state(TASK_INTERRUPTIBLE); \ if (condition) \ break; \ if (!signal_pending(current)) { \ @@ -153,7 +158,8 @@ do { \ ret = -ERESTARTSYS; \ break; \ } \ - finish_wait(&wq, &__wait); \ + current->state = TASK_RUNNING; \ + remove_wait_queue(&wq, &__wait); \ } while (0) #define wait_event_interruptible(wq, condition) \ @@ -166,10 +172,12 @@ do { \ #define __wait_event_interruptible_timeout(wq, condition, ret) \ do { \ - DEFINE_WAIT(__wait); \ + wait_queue_t __wait; \ + init_waitqueue_entry(&__wait, current); \ \ + add_wait_queue(&wq, &__wait); \ for (;;) { \ - prepare_to_wait(&wq, &__wait, TASK_INTERRUPTIBLE); \ + set_current_state(TASK_INTERRUPTIBLE); \ if (condition) \ break; \ if (!signal_pending(current)) { \ @@ -181,7 +189,8 @@ do { \ ret = -ERESTARTSYS; \ break; \ } \ - finish_wait(&wq, &__wait); \ + current->state = TASK_RUNNING; \ + remove_wait_queue(&wq, &__wait); \ } while (0) #define wait_event_interruptible_timeout(wq, condition, timeout) \ @@ -191,34 +200,7 @@ do { \ __wait_event_interruptible_timeout(wq, condition, __ret); \ __ret; \ }) - -#define __wait_event_interruptible_exclusive(wq, condition, ret) \ -do { \ - DEFINE_WAIT(__wait); \ - \ - for (;;) { \ - prepare_to_wait_exclusive(&wq, &__wait, \ - TASK_INTERRUPTIBLE); \ - if (condition) \ - break; \ - if (!signal_pending(current)) { \ - schedule(); \ - continue; \ - } \ - ret = -ERESTARTSYS; \ - break; \ - } \ - finish_wait(&wq, &__wait); \ -} while (0) - -#define wait_event_interruptible_exclusive(wq, condition) \ -({ \ - int __ret = 0; \ - if (!(condition)) \ - __wait_event_interruptible_exclusive(wq, condition, __ret);\ - __ret; \ -}) - + /* * Must be called with the spinlock in the wait_queue_head_t held. */