feat: Detect incorrect multi-threaded use from c based ffi (#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>
This commit is contained in:
Anand Krishnamoorthi
2025-11-17 14:21:13 -06:00
committed by GitHub
parent ad8c543fb5
commit 688e6128d4
16 changed files with 638 additions and 695 deletions
+1 -1
View File
@@ -9,7 +9,7 @@ extern "C" {
#[cfg(feature = "custom_allocator")]
mod allocator {
use std::alloc::{GlobalAlloc, Layout};
use core::alloc::{GlobalAlloc, Layout};
struct RegorusAllocator {}