Skip to content

range on chan not threadsafe #397

@skelterjohn

Description

@skelterjohn
Specifically,

for i := range MyChan { ... }

compiles to something like

for i := <- MyChan; !closed(MyChan); i = <- MyChan { ... }

Which is not (and never will be) threadsafe.

But using range should be threadsafe.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions