pthread_cond_timedwait returning immediately

后端 未结 4 1752
礼貌的吻别
礼貌的吻别 2021-02-15 15:23

I\'m having a strange problem. I have the following code:

    dbg(\"condwait: timeout = %d, %d\\n\", 
        abs_timeout->tv_sec, abs_timeout->tv_nsec);
          


        
4条回答
  •  一生所求
    2021-02-15 15:54

    pthread_cond_timedwait takes an absolute time, not a relative time. You need to make your wait time absolute by adding to the current time to your timeout value.

提交回复
热议问题