I see from cppreference:
std::shared_lock<Mutex>::shared_lock
C++ Thread support library std::shared_lock
shared_lock() noexcept;
(1) (since C++14)
shared_lock( shared_lock&& other ) noexcept;
(2) (since C++14)
explicit shared_lock( mutex_type& m );
(3) (since C++14)
shared_lock( mutex_type& m, std::defer_lock_t t ) noexcept;
(4) (since C++14)
And:
4) Does not lock the associated mutex.
Well, if this defer_lock means we don't lock the mutex, then what's the usage of this lock at all?
When do we need to specify defer_lock parameter, for what kind of usage scenario?
Thanks!