Skip to content
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

Fix #867 #874

Merged
merged 1 commit into from
May 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ bitflags = { version = "2.0.0", default-features = false }
smartstring = { version = "1.0.0", default-features = false }
rhai_codegen = { version = "2.1.0", path = "codegen" }

no-std-compat = { git = "https://gitlab.com/jD91mZM2/no-std-compat", version = "0.4.1", default-features = false, features = ["alloc"], optional = true }
no-std-compat = { git = "https://gitlab.com/jD91mZM2/no-std-compat", version = "0.4.1", default-features = false, features = ["alloc", "compat_sync"], optional = true }
libm = { version = "0.2.0", default-features = false, optional = true }
hashbrown = { version = "0.14.0", optional = true }
core-error = { version = "0.0.0", default-features = false, features = ["alloc"], optional = true }
Expand Down
30 changes: 2 additions & 28 deletions src/func/native.rs
Original file line number Diff line number Diff line change
Expand Up @@ -534,20 +534,7 @@

#[cfg(feature = "sync")]
#[cfg(not(feature = "unchecked"))]
{
// Spin-lock for a short while before giving up
for _ in 0..10 {
match value.try_read() {
Ok(guard) => return Some(guard),
Err(std::sync::TryLockError::WouldBlock) => {
std::thread::sleep(std::time::Duration::from_secs(1))
}
Err(_) => return None,
}
}

return None;
}
return value.try_read();

Check failure on line 537 in src/func/native.rs

View workflow job for this annotation

GitHub Actions / Build (ubuntu-latest, --features testing-environ,sync,serde,metadata,internals,debugging, stable,...

mismatched types
}

/// _(internals)_ Lock a [`Locked`] resource for mutable access.
Expand All @@ -565,20 +552,7 @@

#[cfg(feature = "sync")]
#[cfg(not(feature = "unchecked"))]
{
// Spin-lock for a short while before giving up
for _ in 0..10 {
match value.try_write() {
Ok(guard) => return Some(guard),
Err(std::sync::TryLockError::WouldBlock) => {
std::thread::sleep(std::time::Duration::from_secs(1))
}
Err(_) => return None,
}
}

return None;
}
return value.try_write();

Check failure on line 555 in src/func/native.rs

View workflow job for this annotation

GitHub Actions / Build (ubuntu-latest, --features testing-environ,sync,serde,metadata,internals,debugging, stable,...

mismatched types
}

/// General Rust function trail object.
Expand Down
2 changes: 1 addition & 1 deletion src/types/dynamic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1701,7 +1701,7 @@
#[cfg(not(feature = "sync"))]
Ok(value) => value.into_inner().flatten(),
#[cfg(feature = "sync")]
Ok(value) => value.into_inner().unwrap().flatten(),
Ok(value) => value.into_inner().flatten(),

Check failure on line 1704 in src/types/dynamic.rs

View workflow job for this annotation

GitHub Actions / Build (ubuntu-latest, --features testing-environ,sync,serde,metadata,internals,debugging, stable,...

no method named `flatten` found for enum `Result<dynamic::Dynamic, PoisonError<dynamic::Dynamic>>` in the current scope
// If there are outstanding references, return a cloned copy
Err(cell) => {
if let Some(guard) = crate::func::locked_read(&cell) {
Expand Down
Loading