锁的选项有3个结构类型以及3个它们的常量
struct defer_lock_t {}; struct try_to_lock_t {}; struct adopt_lock_t {}; const defer_lock_t defer_lock; const try_to_lock_t try_to_lock; const adopt_lock_t adopt_lock;
锁的选项用于范围锁的构造函数,它们有下面的含义:
- defer_lock_t:构造范围锁,但不锁定
- try_to_lock_t:构造范围锁,并尝试锁定
- adopt_lock_t:构造范围锁,但不锁定,但接受所有权