Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在使用并行编程编写应用程序并希望使用同步。pthread_mutex_lock我应该使用它们以及pthread_mutex_trylock()何时使用它们有什么区别?
pthread_mutex_lock
pthread_mutex_trylock()
lock阻塞并仅在获得锁时trylock返回,立即返回并且可以成功或失败获得锁。
lock
trylock
手册通常可以回答这些问题。