0

I want my thread wait for some microseconds and currently using usleep for that purpose. I recently noticed pthread_cond_timedwait function which is also used for letting the application wait for sometime. Do you know which is better in terms of waiting time accuracy?

4

1 回答 1

0

光从名字就可以猜到pthread_cond_timedwait是有条件的,也就是说如果条件满足,wait会立即返回。

但是,如果您故意使条件永远为假,那么 pthread_cond_timedwait 可能与 usleep 具有相同的效果。

精度应该是一样的。

于 2013-12-03T09:04:16.920 回答