An RWMutex will block all new readers if a writer is waiting to acquire
the lock, and that writer will only acquire the lock once all current
readers are gone.
Depending on the semantics of your application and the frequency of
writes, that might constrain the throughput through the section
protected by the lock to the rate of writes, especially if the rate of
writes and the attempts to acquire the mutex for reading are roughly in
the same order of magnitude.
On 20.12.20 09:44, 김용빈 wrote:
we usually both read and write for a value. not only read, nor write.
with that, I feel RWMutex is always right choice.
when should I use Mutex instead of RWMutex?
--
You received this message because you are subscribed to the Google
Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to golang-nuts+unsubscr...@googlegroups.com
<mailto:golang-nuts+unsubscr...@googlegroups.com>.
To view this discussion on the web visit
https://groups.google.com/d/msgid/golang-nuts/f597de36-b296-4f59-b756-adb1248387f5n%40googlegroups.com
<https://groups.google.com/d/msgid/golang-nuts/f597de36-b296-4f59-b756-adb1248387f5n%40googlegroups.com?utm_medium=email&utm_source=footer>.
--
Gregor Best
b...@pferdewetten.de
--
You received this message because you are subscribed to the Google Groups
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/golang-nuts/61638263-b169-e149-6426-ddfc09dfe15c%40pferdewetten.de.