Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lots of new functions for channels #19

Merged
merged 13 commits into from
Aug 9, 2023
Merged

Lots of new functions for channels #19

merged 13 commits into from
Aug 9, 2023

Conversation

orsinium
Copy link
Member

@orsinium orsinium commented Aug 8, 2023

Add many new functions for channels, some of which are inspired by "Concurrency in Go" book.

  1. First to select first available message from a list of channels.
  2. Flatten (called Bridge in the book) to turn channels of channels in a regular channel.
  3. Merge to combine multiple channels together.
  4. One-liners for inspecting channels: BufferSize, IsOpen, IsClosed
  5. Small helpers, mostly for better cancellation: Close, Push, Pop

I also found a corner-case for cancellation that is present in most of the functions there. I added a comment for that. I'll address it in a follow-up PR.

@orsinium orsinium changed the title WIP: Lots of new functions for channels Lots of new functions for channels Aug 9, 2023
@orsinium orsinium merged commit 2951a7b into master Aug 9, 2023
6 checks passed
@orsinium orsinium deleted the concurrency-in-go branch August 9, 2023 10:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant