mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-30 20:14:49 +00:00
ephemeral logins
This commit is contained in:
@@ -49,6 +49,7 @@ pub mod net;
|
||||
pub mod rpc;
|
||||
pub mod rpc_client;
|
||||
pub mod serde;
|
||||
pub mod sync;
|
||||
|
||||
#[derive(Clone, Copy, Debug, ::serde::Deserialize, ::serde::Serialize)]
|
||||
pub enum Never {}
|
||||
|
||||
9
core/startos/src/util/sync.rs
Normal file
9
core/startos/src/util/sync.rs
Normal file
@@ -0,0 +1,9 @@
|
||||
pub struct SyncMutex<T>(std::sync::Mutex<T>);
|
||||
impl<T> SyncMutex<T> {
|
||||
pub fn new(t: T) -> Self {
|
||||
Self(std::sync::Mutex::new(t))
|
||||
}
|
||||
pub fn mutate<F: FnOnce(&mut T) -> U, U>(&self, f: F) -> U {
|
||||
f(&mut *self.0.lock().unwrap())
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user