-
Notifications
You must be signed in to change notification settings - Fork 45
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
Sync/Send for Map #265
Sync/Send for Map #265
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ffi::TCOD_map_t is a void*. None of the functions from the libtcod keeps the pointer internally (from what I can see in the code), so Send
is fine to be added. But the library is not thread safe, so you shouldn't add Sync
. Please use a mutex around the type instead.
@L3nn0x I hope I did that right. Let me know and I'll make any required changes. |
I wouldn't add |
I second @Gustorn. Sorry I wasn't clear enough, but I don't think the library should support that. Libtcod was never thread safe so I don't think we should support it either. Maybe we should make the library more rustacean friendly, it's something to think about. |
What about starting a |
I don't know where @tomassedovic wants to go with this library, but it could be a possibility. Feel free to open an issue about it so we can discuss it more in depth. |
I feel like a big part of the Rust philosophy is zero-cost abstractions, adding
In both of these cases, users of the library would be paying for the thread-safe abstractions for no reason. |
@fadeddata just realized I already had an issue about it open here: #259 |
I needed this change so that I could add
Map
as aWrite<'a Map>
resource using specs (https://github.com/slide-rs/specs). It's been working great and I have not witnessed any sort of issues. Is there any reason this couldn't be merged?Thanks!