Search code examples
linuxlinux-kernellinux-device-driverkernel-module

Linux Kernel v.5. linux/wait.h WAIT_QUEUE_HEAD


Is there any function like interruptible_sleep_on() in kernel v5? I found only poll_wait() for polling file.


Solution

  • In linux 3.5 source code, we can see that those functions were deprecated. Look at the comments above their declaration:

    /*  
     * These are the old interfaces to sleep waiting for an event.  
     * They are racy.  DO NOT use them, use the wait_event* interfaces above.  
     * We plan to remove these interfaces.  
     */  
    extern void sleep_on(wait_queue_head_t *q);  
    extern long sleep_on_timeout(wait_queue_head_t *q,  
                          signed long timeout);  
    extern void interruptible_sleep_on(wait_queue_head_t *q);  
    extern long interruptible_sleep_on_timeout(wait_queue_head_t *q,  
                           signed long timeout);  
    

    The function to use instead are: wait_event_killable(), wait_event_timeout(), ...