Skip to content

proposal: Go 2: variable length channel #64855

Closed as not planned
Closed as not planned
@coder1966

Description

@coder1966

Proposal Details

The channel length can variable.

c := make(chan int , <MaxLen> [,<MinLen>] [,<TimeDuration>])

first:
cap(c) = <MinLen>

if full:
cap(c) = cap(c) * 2 // Max <MaxLen>

if len(c) < cap(c) /4 && timeout <TimeDuration>{
cap(c) = cap(c) / 2 // Min <MinLen>
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions