experimental-lda icon indicating copy to clipboard operation
experimental-lda copied to clipboard

Difference between shared_mutex::lock_shared() and shared_mutex::lock()

Open tangzhenyu opened this issue 7 years ago • 2 comments

Who knows the difference between following two functions.

shared_mutex::lock_shared() and shared_mutex::lock()

tangzhenyu avatar Mar 20 '17 03:03 tangzhenyu

shared_mutex::lock() provides exclusive ownership to the mutex whereas shared_mutex::lock_shared() provides a shared ownership. Such constructs are useful for example when you want to have a write and read lock, i.e. there is no problem in multiple threads reading at same time but when you want to write only one thread should write and no one else should be reading at the same time.

manzilzaheer avatar Mar 26 '17 17:03 manzilzaheer

thanks for your answering,I am developing unsymmetrical function to this code,may I have your help please?

tangzhenyu avatar Mar 27 '17 03:03 tangzhenyu