wait_event_interruptible_timeout interface for parsing linux kernel

1. Prototype

  #define wait_event_interruptible_timeout(wq_head, condition, timeout) \
  ({ \
    long __ret = timeout; \
    might_sleep(); \
    if (!___wait_cond_timeout(condition)) \
      __ret = __wait_event_interruptible_timeout(wq_head, \
                    condition, timeout); \
      __ret; \
  })

 

2. Use the scene

  To sleep timeout condition is met or exits the sleep state

3. Support can interrupt the process of sleep, which means you can send a signal to sleep, will process the signal response

4. Return value resolution

  4.1 when the return value is greater than 0, represents the return of the remaining time (in jiffy units), conditions are satisfied, i.e. has not timed out, the condition has been reached, it is awakened

  4.2 When the return value is zero, the timeout autowake

 

Guess you like

Origin www.cnblogs.com/dakewei/p/11206441.html