Skip to content

Safe and convenient resource destruction #288

@kvark

Description

@kvark

Would be nice to have our resources self-destructed, though I'm not sure we can really do that with our architecture and potential other device back-ends.

The path seems to be mostly cleared now (at last!). Here are the steps we will take:

  • wrap resources inside handles with Arc<>
  • make Factory to store the references to all created resources
  • implement a sweep() pass for the device/factory. The device may be able to enumerate all the factories and call sweep() on them.
  • add a trait that is implemented by both Rc and Arc. Examples.
  • generically parametrize all the handle types by this trait
  • make sure using the Graphics enforces Rc, while the general way goes with Arc
  • proceed with @csherratt's mutability protection. It's big, so needs its own issue.

PR #633 covers the basics.
Issue #636 will cover Rc usage.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions