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/CAKvHMgTO%3DxfFQ_u7aO9UE-1vHHEKmdhr47sro2mnp6DkEb6mPA%40mail.gmail.com.

Reply via email to