-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Description
While reading the code, I noticed what I think is a race condition in the Put() loop, in lines 465:
for {
oldHead := P(shard.Head.Load())
if shard.Head.CompareAndSwap(oldHead, obj) { // (1)
obj.SetNext(oldHead) // (2)
return
}If between (1) and (2) another goroutine (using the shardID) retrives the obj and starts to use it,
this breaks.
Shouldn't (2) come before (1) ?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels