Skip to content

Assert parking lots have no suspended waiters at destruction#25

Merged
dprokoptsev merged 1 commit into
hudson-trading:masterfrom
jeet-dekivadia:codex/assert-no-parked-waiters
Jun 10, 2026
Merged

Assert parking lots have no suspended waiters at destruction#25
dprokoptsev merged 1 commit into
hudson-trading:masterfrom
jeet-dekivadia:codex/assert-no-parked-waiters

Conversation

@jeet-dekivadia

@jeet-dekivadia jeet-dekivadia commented May 30, 2026

Copy link
Copy Markdown
Contributor

Summary

  • assert that a ParkingLotImpl is empty before its intrusive wait queue is destroyed
  • extend the lifetime check already present on Channel to Event, Semaphore, and ParkingLot
  • surface misuse at the destruction site instead of silently unlinking suspended awaiters and leaving their tasks stranded

Validation

  • git diff --check
  • printf '#include "corral/corral.h"\\nint main() { corral::Event e; corral::Semaphore s; corral::ParkingLot p; }\\n' | clang++ -std=c++20 -fsyntax-only -I. -x c++ -
  • cmake -S . -B build -DCMAKE_C_COMPILER=gcc-14 -DCMAKE_CXX_COMPILER=g++-14 -DCORRAL_BOOST=/opt/include -DCORRAL_CATCH2=https://github.com/catchorg/catch2
  • cmake --build build -j2
  • ctest --test-dir build --output-on-failure
  • focused Linux harness: empty destruction exited 0; destruction with one parked waiter reached the custom CORRAL_ASSERT handler with exit 42

Signed-off-by: Jeet Dekivadia <jeet.university@gmail.com>
@jeet-dekivadia

Copy link
Copy Markdown
Contributor Author

Small follow-up for review context. This extends the existing Channel lifetime defense to the shared parking-lot base used by Event, Semaphore, and ParkingLot. Destroying a lot while a coroutine is still parked otherwise leaves an intrusive waiter behind; asserting at destruction makes that misuse deterministic at the ownership boundary.

Validation from preparation: git diff --check; clang++ -std=c++20 -fsyntax-only probe including corral/corral.h and constructing Event, Semaphore, and ParkingLot; GCC 14 configure, build, and CTest; and a focused harness that exited 0 for empty destruction and reached the custom CORRAL_ASSERT path with exit 42 for one parked waiter.

@dprokoptsev dprokoptsev merged commit 9c91dd3 into hudson-trading:master Jun 10, 2026
12 checks passed
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.

2 participants