Skip to content

Return the Promises waiter count for inspection - #1115

Open
OskarEichler wants to merge 3 commits into
ruby-concurrency:masterfrom
OskarEichler:codex/promises-waiter-count
Open

Return the Promises waiter count for inspection#1115
OskarEichler wants to merge 3 commits into
ruby-concurrency:masterfrom
OskarEichler:codex/promises-waiter-count

Conversation

@OskarEichler

Copy link
Copy Markdown
Contributor

Returns the AtomicFixnum value used by the lock-free event waiter registry. The current inspection path calls each on AtomicFixnum and raises instead of reporting the count.

Verified by focused Promises specs and models; the review composite passes 2,796 examples with no failures.

@bensheldon bensheldon left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a test for the behavior as it sounds like this has existed because it's untested.

@OskarEichler

Copy link
Copy Markdown
Contributor Author

Added a regression spec that checks the waiter count before, during, and after a blocked wait. The focused Promises spec passes: 61 examples, 0 failures.

@OskarEichler

Copy link
Copy Markdown
Contributor Author

Follow-up: the first regression spec used an ensure form that Ruby 2.3 and 2.4 could not parse, which caused the three legacy-Ruby CI failures. I rewrote the cleanup using an explicit begin/ensure, removed the unnecessary safe-navigation calls, and added the missing assertion that the waiter count returns to zero after resolution.

The focused Promises spec now passes with 61 examples and 0 failures on Ruby 4.0.6, and the updated spec is syntactically compatible with the legacy parser form exercised by CI.

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