骑行结束后,用户会将其锁定,然后由下一位骑行者用手机解锁。
They are locked by the user after riding, and then unlocked by the next rider with a mobile phone.
代码可以反复对互斥对象锁定和解锁,以检查值的任何变化。
Your code could repeatedly lock and unlock the mutex, checking for any changes to the value.
如果使用scoped_lock,就不需要显式地锁定或解锁文件;锁定发生在构造器内,每当您退出该范围,就会自动发生解锁。
Using scoped_lock, you don't need to explicitly lock or unlock the file; the locking occurs inside the constructor, and the unlocking happens automatically whenever you exit the scope.
应用推荐