Skip to content

Add Send impl for Module#4

Open
mcb2003 wants to merge 2 commits intosm-Fifteen:masterfrom
mcb2003:send-impls
Open

Add Send impl for Module#4
mcb2003 wants to merge 2 commits intosm-Fifteen:masterfrom
mcb2003:send-impls

Conversation

@mcb2003
Copy link

@mcb2003 mcb2003 commented May 4, 2022

This PR unsafely implements send for openmpt::module::Module. This is safe because the openmpt documentation states:

  • You must ensure to only ever access a particular libopenmpt object from a
    single thread at a time.
  • Consecutive accesses can happen from different threads.
  • Different objects can be accessed concurrently from different threads.

So objects created by libopenmpt are Send, but not Sync.

I also fixed a few of the clippy warnings by E.G. replacing the deprecated x...y inclusive range operator with the newer x..=y.

I noticed that this repository hasn't been touched in quite a while, so I thaught I'd let you know I'd be happy to take over this project if you've lost interest / don't have the time any more. There are quite a few things I'd love to do to improve the API (better error handling, less copying when dealing with strings allocated on the libopenmpt side, etc). If you'd like to keep it though, no worries at all, just thaught I'd offer.

mcb2003 added 2 commits May 4, 2022 10:42
According to the libopenmpt docs: "Consecutive accesses can happen from different threads.                   ", which means all openmpt types should be Send.
@mcb2003
Copy link
Author

mcb2003 commented May 4, 2022

Sorry, just realised this is a duplicate of #3. I should check before I submit a PR. 🤦

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