runtime: rewrite channel implementation

This rewrite simplifies the channel implementation considerably, with
34% less LOC. Perhaps the most important change is the removal of the
channel state, which made sense when we had only send and receive
operations but only makes things more compliated when multiple select
operations can be pending on a single channel.

I did this rewrite originally to make it possible to make channels
parallelism-safe. The current implementation is not parallelism-safe,
but it will be easy to make it so (the main additions will be a channel
lock, a global select lock, and an atomic compare-and-swap in
chanQueue.pop).
This commit is contained in:
Ayke van Laethem
2024-10-27 08:44:19 +01:00
committed by Ron Evans
parent b7a3fd8d2f
commit 5ebda89d78
5 changed files with 408 additions and 587 deletions
+358 -540
View File
File diff suppressed because it is too large Load Diff