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

Move the trace recording of destroy events out of triage_resources #5036

Merged
merged 1 commit into from
Jan 11, 2024

Conversation

nical
Copy link
Contributor

@nical nical commented Jan 10, 2024

Description

This PR moves all of the trace::Action::DestroyFoo(id) out of triage_resource. The main motivation is to avoid holding the trace lock for a long time and let the resource drop impls take that lock without risking deadlocks if the reference count happens to go to zero during triage.

This will allow us to remove the free_resource tracker in a followup which is needed for #4917.

Incidentally I'm happy about how it simplifies the code. It makes sense for this stuff to be handled by the resources themselves instead of the lifecycle triaging code which in an ideal world wouldn't need to do resource-specific logic. triage_resource does not need to take an on_remove callback anymore.

Checklist

  • Run cargo fmt.
  • Run cargo clippy.
  • Run cargo xtask test to run tests.

@nical nical requested a review from a team as a code owner January 10, 2024 21:39
Copy link
Member

@cwfitzgerald cwfitzgerald left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Truly amazing!

@cwfitzgerald cwfitzgerald merged commit c90f43b into gfx-rs:trunk Jan 11, 2024
27 checks passed
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.

2 participants