Skip to content

Commit 688e612

Browse files
authored
feat: Detect incorrect multi-threaded use from c based ffi (microsoft#499)
Add runtime detection for shared handle misuse wrap the FFI engine handle with parking_lot::RwLock when the new contention_checks feature is enabled, surfacing a clear “handle is already in use” error instead of allowing undefined behavior keep the feature optional so no_std builds or environments that supply their own synchronization can opt out caution users that this guards the handle itself but does not make the engine’s operations globally thread-safe on its own Signed-off-by: Anand Krishnamoorthi <anakrish@microsoft.com>
1 parent ad8c543 commit 688e612

16 files changed

Lines changed: 638 additions & 695 deletions

File tree

.github/workflows/test-ffi.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,5 @@ jobs:
2424
cargo fetch
2525
cargo build -r --frozen
2626
cargo clippy --all-targets --no-deps -- -Dwarnings
27+
cargo test --features contention_checks --frozen
2728
working-directory: ./bindings/ffi

Cargo.lock

Lines changed: 47 additions & 121 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)