-
-
Notifications
You must be signed in to change notification settings - Fork 14.1k
Closed
Description
This seems to have been removed here, as part of the sync cleanup for #19274: 689ef2d
The commit message says:
Because this removes the
libsynccrate, it is a:[breaking-change]
However, all uses of
libsyncshould be able to reroute through
std::syncandstd::comminstead.
My use-case for StaticMutex was protecting global state in C libraries in emk/rust-cld2 using code like:
extern crate sync;
use sync::mutex::{StaticMutex, MUTEX_INIT};
static LIBRARY_LOCK: StaticMutex = MUTEX_INIT;
fn access_global_resource() {
let _ = LIBRARY_LOCK.lock();
unsafe { call_thread_unsafe_c_api(); }
}Is there a clean way to do this with guards, etc.? I suppose I could use Once to bootstrap my way up to a global mutex, and use that to guard call_thread_unsafe_c_api, but that seems a lot more complicated than using StaticMutex. Am I simply missing the obvious solution here?
Thank you very much for working to rationalize sync!
Metadata
Metadata
Assignees
Labels
No labels