Skip to content

Comments

match from waiting producer when possible. #4738

Closed
glycerine wants to merge 1 commit intoponylang:mainfrom
glycerine:fix_producer_consumer_example
Closed

match from waiting producer when possible. #4738
glycerine wants to merge 1 commit intoponylang:mainfrom
glycerine:fix_producer_consumer_example

Conversation

@glycerine
Copy link

prevents premature termination when producers are waiting

@ponylang-main ponylang-main added the discuss during sync Should be discussed during an upcoming sync label Sep 28, 2025
@glycerine
Copy link
Author

glycerine commented Sep 28, 2025

Also here is my own version from scratch. comments welcome.

(update), NOW OLD/IGNORE: gist.github.com/ponylang-gists/53f2ca1e746f28fc92753dea3e78c14c)

(update), NEW/IMPROVED:
https://gist.github.com/ponylang-gists/11523e64d3f11dcee275c62de0ff50ad

@SeanTAllen
Copy link
Member

The formatting standard is 2 spaces. Please revert the last commit.

See https://github.com/ponylang/ponyc/blob/main/STYLE_GUIDE.md

@glycerine glycerine force-pushed the fix_producer_consumer_example branch 12 times, most recently from 57de8bf to 587ebc6 Compare September 30, 2025 00:09
@glycerine
Copy link
Author

The formatting standard is 2 spaces. Please revert the last commit.

noted. corrected.

@glycerine
Copy link
Author

glycerine commented Sep 30, 2025

the producer-consumer solution here is still buggy.

I wrote a little assertion file to test my solution (passed) and this solution (did not pass, at least 2 bugs detected). The specific failures can be studied on this branch, if anyone wants to spend time on it:

https://github.com/glycerine/ponyc/blob/still_borked_prodcons/examples/producer-consumer/buffer.pony#L56

Big picture, I would just suggest replacing it with my re-worked solution.

If that is acceptable, I can prepare a minimal version of it; it is here: https://github.com/glycerine/ponyc/blob/bench/examples/producer-consumer/fifo.pony

It not-- no harm, no foul.

The assertion file is here https://github.com/glycerine/ponyc/blob/still_borked_prodcons/examples/producer-consumer/assert.pony
I didn't want to thread TestHelper throughout the code, so this just uses C FFI to crash on assert immediately.

@glycerine
Copy link
Author

I went ahead and put my rewrite here.

#4740

code fix: match from waiting producer when possible.
prevents premature termination when producers are waiting

readme: Define the problem exactly. Give some
historical background about this important topic.

readme: Add questions and give a problem set with
basic, medium, and advance challenge levels.
@glycerine glycerine force-pushed the fix_producer_consumer_example branch from 587ebc6 to 7fecc3c Compare September 30, 2025 17:42
@SeanTAllen
Copy link
Member

closing in favor of iterating on #4740.

@SeanTAllen SeanTAllen closed this Oct 7, 2025
@ponylang-main ponylang-main removed the discuss during sync Should be discussed during an upcoming sync label Oct 7, 2025
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.

3 participants