A map using a lock-free concurrency using left-right algo, written in Go

Panic on uninitialized read handler

authored by

Johannes Kohnen and committed by joh.dev 5e65db59 66d6d686

+6 -2
+6 -2
lrmap.go
··· 20 20 readHandlers map[*ReadHandler]struct{} 21 21 } 22 22 23 - mapT map[Key]Value 24 - 25 23 Key int 26 24 Value int 25 + 26 + mapT map[Key]Value 27 27 ) 28 28 29 29 func New() *LRMap { ··· 179 179 } 180 180 181 181 func (r *ReadHandler) Enter() { 182 + if r.lrm == nil { 183 + panic("reader illegal state: must create with New()") 184 + } 185 + 182 186 atomic.AddUint64(&r.epoch, 1) 183 187 r.live = r.lrm.getMapAtomic() 184 188 }