That pkg is not a RW lock though - it is an exclusive mutex. The pseudo code I 
provided is a RW try lock.  

> On Dec 4, 2019, at 4:49 AM, pierre.cu...@gmail.com wrote:
> 
> 
> This may be of relevance to you:
> https://pkg.go.dev/gvisor.dev/gvisor/pkg/tmutex?tab=doc
> 
> 
> Le mercredi 4 décembre 2019 01:21:41 UTC+1, Liam a écrit :
>> 
>> I have a problem that is trivially solved via
>> 
>> door sync.RWMutex
>> 
>> func Reader() T {
>>    if !door.TryRLock() { // missing in stdlib :-(
>>       return busy
>>    }
>>    defer door.RUnlock()
>>    ...
>> }
>> 
>> func Writer() {
>>    door.Lock()
>>    defer door.Unlock()
>>    ...
>> }
>> 
>> How does one achieve this in Go?
>> 
> 
> -- 
> 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/94c7a670-0a71-432a-aa19-035e1f4c9648%40googlegroups.com.

-- 
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/A958A582-0660-4C45-BFB7-7807D052447B%40ix.netcom.com.

Reply via email to