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

Bound of UncapturedErrorHandler is more restrictive than it should be #5395

Open
kpreid opened this issue Mar 15, 2024 · 0 comments
Open

Bound of UncapturedErrorHandler is more restrictive than it should be #5395

kpreid opened this issue Mar 15, 2024 · 0 comments
Labels
area: api Issues related to API surface type: enhancement New feature or request

Comments

@kpreid
Copy link
Contributor

kpreid commented Mar 15, 2024

The definition of UncapturedErrorHandler, the callback given to Device::on_uncaptured_error(), is an alias for

Fn(Error) + Send + 'static

The combination of Fn, Send, and no Sync is weird. I believe that it should be replaced with either:

Fn(Error) + Send + Sync + 'static

implying that the callback could be called simultaneously from multiple threads, where it currently cannot*, or

FnMut(Error) + Send + 'static

allowing the callback to take advantage of not being called simultaneously. This is not a soundness issue, just an unnecessary empty space in between what is permitted for wgpu and what is permitted for its callers.


* Say, what happens if the uncaptured error handler itself performs a wgpu operation that errors? Deadlock? Possibly the error handler ought to be in an Arc so it can be called outside the lock.

@teoxoy teoxoy added type: enhancement New feature or request area: api Issues related to API surface labels Mar 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: api Issues related to API surface type: enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants