Commit Graph
3 Commits
Author SHA1 Message Date
Lars Wirzenius 4577682fd6 refactor(src/pull_queue.rs): drop "end" method, add Drop impl
This makes it harder to forget to close the producer end.

Suggested-by: Fintan
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2025-05-14 13:17:20 +03:00
Lars Wirzenius 19ede6dfed refactor(src/pull_queue.rs): avoid asserts
I didn't like having asserts, and didn't want debug_asserts. With
plain asserts, the program would have panicked. With debug_asserts, the
program would have silently overwritten the item in the queue.
Instead, change the method to return whether it was able to set, and
have the caller cope with not being able to set. The caller needs to
be able handle that (and was already doing so).

Found-by: Fintan
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2025-05-14 08:45:34 +03:00
Lars Wirzenius c7dbff55e5 feat: add a "pull queue" data type
This will be useful for inter-thread synchronization in situations
where the producer thread should not produce anything until at least
one consumer is ready for it.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2025-05-13 09:02:12 +03:00