Skip to content

Make WrappedObject Send + Sync using RwLock#307

Open
martin-hughes wants to merge 1 commit into
rust-osdev:mainfrom
martin-hughes:rw_lock-object
Open

Make WrappedObject Send + Sync using RwLock#307
martin-hughes wants to merge 1 commit into
rust-osdev:mainfrom
martin-hughes:rw_lock-object

Conversation

@martin-hughes

Copy link
Copy Markdown
Contributor

This PR is inspired by the same reason I asked #302 - I'd like to be much more sure acpi is actually safe. It's a suggestion really, to see if you like it @IsaacWoods. Thoughts?

There are, IMO, at least a couple of things I don't like about WrappedObject.

  1. It is currently very easy to use WrappedObject in an unsafe way despite the unsafe impl statements, and
  2. The deref behaviour isn't totally intuitive and I think using the inner object benefits from being more explicit.

So with that in mind I've generated this PR.

I'm not sure if you have any feelings about AI generated code @IsaacWoods so for full disclosure - the heavy lifting here was done by Claude's Opus 4.8 model based on my prompts and questions.

I've then refined, reviewed, edited and tested it - no vibe coding here! But I can imagine you might think of a better way to achieve the same goal, in which case I'm happy to make a second attempt.

This changes the WrappedObject interface, so will need a version bump.

The aim is to remove the unsafe Send and Sync implementations, to:

- Make sure WrappedObject really is Send / Sync
- Make it easier for users to use WrappedObject in a thread-safe way.
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.

1 participant