Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WaitMap could have a mechanism to wake a waiter but immediately requeue it #464

Open
hawkw opened this issue Nov 28, 2023 · 3 comments
Open
Labels
crate/maitake Related to the `maitake` crate kind/enhancement New feature or request

Comments

@hawkw
Copy link
Owner

hawkw commented Nov 28, 2023

cc @jamesmunns

Currently, when waking a task waiting on a WaitMap, the task's entry is always removed from the list. This means that it won't be notified again if we wake the same key with a different value. This makes it difficult to implement "stream-style" rather than "request-response style" APIs using WaitMap.

@hawkw hawkw added kind/enhancement New feature or request crate/maitake Related to the `maitake` crate labels Nov 28, 2023
@jamesmunns
Copy link
Collaborator

@hawkw this seems neat, though WaitMap only holds an intrusive handle to a single item, and wake is not async.

Is the intent to use this sort of like a channel router? It seems like that feels more like HashMap<K, Sender<V>> or something (which also seems useful!).

@hawkw
Copy link
Owner Author

hawkw commented Nov 28, 2023

Yeah...I'm not actually sure if this is the right use-case for WaitMap. I started working on a "server-streaming" style API for Calliope request-response, but I think, after further consideration, that it doesn't really make sense as a thing to add.

@jamesmunns
Copy link
Collaborator

Yeah, WaitMap is sort of like a HashMap<K, IntrusivelyStoredOneShot<T>>, honestly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
crate/maitake Related to the `maitake` crate kind/enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants