pthread_cond_timedwait()

前端 未结 7 1560
有刺的猬
有刺的猬 2020-12-16 05:22
void wait(int timeInMs)
{
    struct timespec timeToWait;
    timeToWait.tv_sec = 5;
    timeToWait.tv_nsec = timeInMs*1000;

    int rt;

    pthread_mutex_lock(&am         


        
7条回答
  •  醉酒成梦
    2020-12-16 06:17

    The pthread_cond_timedwait function takes an absolute time, not a relative time. It takes the time you want to stop waiting, not how long you want to wait.

提交回复
热议问题