On the other hand, if the lock is held for a longer time, spinning is wasteful as the spinning thread consumes CPU without doing anything useful.
另一方面,如果锁被占有很长时间,那么自旋的线程只会消耗CPU而不做任何有用的工作,因此带来浪费。
They use hand sanitizers between customers, always use a fresh thread, and regularly clean brow brushes and scissors with antibacterial germicides.
他们在客户间使用消毒剂擦手,并且总是使用新的棉线,眉刷和剪刀也定时用抗菌清洗剂清洗。
On the other hand, if the calling thread needs to be blocked for a specific time, then pthread_cond_timedwait is used to block the thread.
在另外一方面,如果调用线程需要被阻塞一段确定的时间,那么就可以使用pthread_cond _ timedwait来阻塞这个线程。
应用推荐