Wake up a std::thread from usleep

后端 未结 6 1830
被撕碎了的回忆
被撕碎了的回忆 2021-02-14 05:25

Consider the following example:

#include 
#include 
#include 

#include 
#include 

         


        
6条回答
  •  终归单人心
    2021-02-14 06:19

    Just use a semaphore, call sem_timedwait instead of usleep, and call sem_post before calling join

提交回复
热议问题