• debing.sun's avatar
    Use usleep() instead of sched_yield() to yield cpu (#13183) · f4481e65
    debing.sun authored
    when the main thread and the module thread are in the same thread,
    sched_yield() can work well.
    when they are both bind to different cpus, sched_yield() will look for
    the thread with the highest priority, and if the module thread is always
    the highest priority on a cpu, it will take a long time to let the main
    thread to reacquire the GIL.
    
    ref https://man7.org/linux/man-pages/man2/sched_yield.2.html
    ```
    If the calling thread is the only thread in the highest priority
    list at that time, it will continue to run after a call to
    sched_yield().
    ```
    f4481e65
module.c 564 KB