Skip to content

#108: Channel(0) send() now blocks until a receiver takes the value - #113

Merged
EdmondDantes merged 1 commit into
mainfrom
108-channel0-send-returns-without-a-waiting-receiver
May 10, 2026
Merged

EdmondDantes merged 1 commit into
mainfrom
108-channel0-send-returns-without-a-waiting-receiver

Conversation

@EdmondDantes

Copy link
Copy Markdown
Contributor

The unbuffered slot used to act as a 1-message buffer: the first send deposited into rendezvous_value and returned without waiting, breaking the documented Go-style rendezvous semantics and the happens-before guarantee between sender and receiver.

Fix in METHOD(send) cap=0 path: if no receiver is queued, block in waiting_senders until recv() takes the value and wakes us. When the slot-owner wakes after consumption, if both queues still have waiters wake the next sender so it refills the slot — this keeps the chain moving for N senders / M receivers without deadlock.

sendAsync is unchanged (still non-blocking, deposits into the slot).

Also:

  • Tests channel/003 and channel/011 updated to reflect proper rendezvous ordering (send completes only after recv takes the value).
  • Renamed fuzzy_tests/ to fuzzy-tests/ for path consistency; updated all harness files, generated tests, feature files, CI workflows and docs.
  • CHANGELOG: added Fixed/Changed entries for 0.7.0.

The unbuffered slot used to act as a 1-message buffer: the first send
deposited into rendezvous_value and returned without waiting, breaking
the documented Go-style rendezvous semantics and the happens-before
guarantee between sender and receiver.

Fix in METHOD(send) cap=0 path: if no receiver is queued, block in
waiting_senders until recv() takes the value and wakes us. When the
slot-owner wakes after consumption, if both queues still have waiters
wake the next sender so it refills the slot — this keeps the chain
moving for N senders / M receivers without deadlock.

sendAsync is unchanged (still non-blocking, deposits into the slot).

Also:
- Tests channel/003 and channel/011 updated to reflect proper rendezvous
  ordering (send completes only after recv takes the value).
- Renamed fuzzy_tests/ to fuzzy-tests/ for path consistency; updated all
  harness files, generated tests, feature files, CI workflows and docs.
- CHANGELOG: added Fixed/Changed entries for 0.7.0.
@EdmondDantes EdmondDantes self-assigned this May 10, 2026
@EdmondDantes EdmondDantes linked an issue May 10, 2026 that may be closed by this pull request
@EdmondDantes
EdmondDantes merged commit f5b37f3 into main May 10, 2026
5 of 6 checks passed
@EdmondDantes
EdmondDantes deleted the 108-channel0-send-returns-without-a-waiting-receiver branch May 10, 2026 17:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Channel0 send returns without a waiting receiver

1 participant