all of those are condition=0 cause waiting!!!!!!
First, we can see the prototype in the kernel!!!
__wait_event!!!!!!!!!!!! #define __wait_event(wq, condition) / wait_event!!!!!!!!!!!!!!! #define wait_event(wq, condition) /
do { /
DEFINE_WAIT(__wait); /
/
for (;;) { // it is an infinite loop!!!!!!!!
prepare_to_wait(&wq, &__wait, TASK_UNINTERRUPTIBLE); /
if (condition) /
break; /
schedule(); /
} /
finish_wait(&wq, &__wait); /
} while (0)
do { /
if (condition)//if condition is 0,waiting!!!!!!
break; /
__wait_event(wq, condition); /
} while (0)
wait_event_interruptible!!!
#define wait_event_interruptible(wq, condition)
{
int __ret = 0;
if (!(condition))
__wait_event_interruptible(wq, condition, __ret);
__ret;
}
#define __wait_event_interruptible(wq, condition, ret) /
do { /
DEFINE_WAIT(__wait); /
/
for (;;) { /
prepare_to_wait(&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_timeout(wq, condition, timeout) /
({ /
long __ret = timeout; /
if (!(condition)) /
__wait_event_interruptible_timeout(wq, condition, __ret); /
__ret; /
})
#define __wait_event_interruptible_timeout(wq, condition, ret) /
do { /
DEFINE_WAIT(__wait); /
/
for (;;) { /
prepare_to_wait(&wq, &__wait, TASK_INTERRUPTIBLE); /
if (condition) /
break; /
if (!signal_pending(current)) { /if it is not wakened by a signal!!!!!!!
ret = schedule_timeout(ret); /a soft delay also schedule!!!!!
if (!ret) /
break; /
continue; /
} /
ret = -ERESTARTSYS; /
break; /
} /
finish_wait(&wq, &__wait); /
} while (0)