-
Notifications
You must be signed in to change notification settings - Fork 0
Updating dggal-rust unified-crate with the latest commits on ecere/dggal and ecere/eC #5
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
Open
MichaelJendryke
wants to merge
3
commits into
unified-crate
Choose a base branch
from
mj/update-unified-crate
base: unified-crate
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -99,6 +99,8 @@ impl Deref for Instance { | |
| } | ||
|
|
||
| // eC runtime singleton | ||
| unsafe impl Sync for Application {} | ||
| unsafe impl Send for Application {} | ||
|
Comment on lines
+102
to
+103
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @jerstlouis also here for the |
||
| pub struct Application { | ||
| pub app: ecrt_sys::Application, | ||
| } | ||
|
|
@@ -133,34 +135,34 @@ pub trait TTAU64 { | |
|
|
||
| impl TTAU64 for u64 { | ||
| fn from_u64(value: u64) -> Self { | ||
| unsafe { transmute(value) } | ||
| value | ||
| } | ||
| fn to_u64(&self) -> u64 { | ||
| unsafe { transmute(*self) } | ||
| *self | ||
| } | ||
| } | ||
| impl TTAU64 for i64 { | ||
| fn from_u64(value: u64) -> Self { | ||
| unsafe { transmute(value) } | ||
| u64::cast_signed(value) | ||
| } | ||
| fn to_u64(&self) -> u64 { | ||
| unsafe { transmute(*self) } | ||
| i64::cast_unsigned(*self) | ||
| } | ||
| } | ||
| impl TTAU64 for f64 { | ||
| fn from_u64(value: u64) -> Self { | ||
| unsafe { transmute(value) } | ||
| f64::from_bits(value) | ||
| } | ||
| fn to_u64(&self) -> u64 { | ||
| unsafe { transmute(*self) } | ||
| f64::to_bits(*self) | ||
| } | ||
| } | ||
| impl TTAU64 for f32 { | ||
| fn from_u64(value: u64) -> Self { | ||
| unsafe { transmute(value as u32) } | ||
| f32::from_bits(value as u32) | ||
| } | ||
| fn to_u64(&self) -> u64 { | ||
| unsafe { transmute::<f32, u32>(*self) as u64 } | ||
| f32::to_bits(*self) as u64 | ||
| } | ||
| } | ||
| impl TTAU64 for u32 { | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
@jerstlouis I had a few issues to get tests to work concurrently and I just expanded your commit to also wrap DGGAL with Send + Sync. Do you think it is okay?
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.
@MichaelJendryke To run the initial example concurrency test that was not necessary.
Could you please clarify what the new test is doing?
What is this new lazy mutex stuff doing?
The DGGRS class is already thread safe and none of the methods modifies the object state, so they can freely be executed in parallel without locking any mutex.
The Application class is intended to be a singleton.
Instantiating multiple Application class will likely break things at this point.
Are you trying to use Application in multiple threads?
Since it's only used for instantiating DGGAL, which is then use to instantiate the DGGRS(s), this would ideally all be done in the main thread during initialization stage (though I don't think it would cause any problem to instantiate a new DGGRS from the same DGGAL from other threads as needed later on).
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.
Is this Lazy stuff is just to try to avoid the user having to initialize this thing themselves and ensure there is global singleton set up for these objects? I think I actually had something like this in the bindings for an earlier version.
I remember being advised against this when developing the Rust bindings, but I understand doing this if this is to avoid GeoPlegma users having to do this themselves since it's specific to a particular backend.