Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions pkg/store/objectstore/flatfs/flatfs.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,14 +109,19 @@ func (m *opMap) Begin(name string) *opResult {
}

op := opIface.(*opResult)
// someone else doing ops with this key, wait for
// the result
// someone else doing ops with this key, wait for the
// result Note: we are using `op.mu` as a syncing
// primitive to make several threads WAIT. The first
// operation will grab the write-lock. Everyone else
// tries to grab a read-lock as a way of waiting for
// the operation to be finished by the thead that
// grabbed the write-lock. The Read-lock does not need
// to be unlocked, as the operation is never used or
// re-used for anything else from that point.
op.mu.RLock()
if op.success {
op.mu.RUnlock()
return nil
}
op.mu.RUnlock()

// if we are here, we will retry the operation
}
Expand Down
Loading