Skip to content

Is there such thing as "benign race condition"? #2

Open
@leventov

Description

@leventov

@peterbourgon to avoid edit wars, I invite you to have discussions here.

Many people use the term "benign race condition", including in literature.

The benign race condition I referred to in the checklist would be like this:

var m sync.Map

func foo(k string) string {
	v, ok := m.Load(k)
	if !ok {
		v = compute(k)
		m.Store(k, v)
	}
	return v.(string)
}

Assuming compute() is safe for concurrent calling and idempotent.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions