Skip to content

ring_buffer #233

@klemens-morgenstern

Description

@klemens-morgenstern

A ring_buffer could be useful in situations where one wants a channel but back-pressure would be an issue.

It should have the same API as a channel.

On write, the writing coroutine should be yield to a reading coroutine if present.
If the ring-buffer is full the awaiting coroutine should post it-self to avoid starvation.

The ring_buffer could also have a post function, that posts a value and then the completion.
This function could also be thread-safe (since it posts internally) allowing for cross-thread notifications.

T = void would be a notifier, especially when of size 1.

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