Wake up a std::thread from usleep

后端 未结 6 2382
借酒劲吻你
借酒劲吻你 2021-02-14 05:28

Consider the following example:

#include 
#include 
#include 

#include 
#include 

         


        
6条回答
  •  梦毁少年i
    2021-02-14 06:30

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

提交回复
热议问题