-
-
Notifications
You must be signed in to change notification settings - Fork 80
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
add higher level start_blocking
api
#191
Comments
spawn_blocking
apistart_blocking
api
just noticed there's already a |
It's called There is one bigger problem with |
ya i think that's a fair concern, it should be made clear to the user that this is less of a thread, with the ability to communicate with other threads, and more of a background worker pool which can execute "atomic" (self-contained, no threading semantics, etc.) blocking operations; then the user would use the api with the mutable semantics expected e.g. let value = Mutable::new(None);
Task::start(clone!((value) async move {
value.set(Task::start_blocking_awaitable(blocking_function).await);
}))
value.signal().map(...) |
while the current web worker wrapper is much higher level than the gloo api, i think the callback channel semantics of
start_blocking_with_output_task
is still too low level, instead the api should simply take a blocking function and allow the user to.await
its completion in a separate thread i.e.Task::start_blocking(blocking_function).await
, which allows users to manage responses at a higher level using.await
semantics instead of callbacksthis was actually pretty straightforward to implement using the existing api
The text was updated successfully, but these errors were encountered: