Trait emf_core_base_rs_ffi::sys::api::SysBinding [−][src]
pub trait SysBinding { unsafe fn shutdown(&mut self) -> !; unsafe fn panic(&self, error: Option<NonNullConst<u8>>) -> !; unsafe fn has_function(&self, id: FnId) -> Bool; unsafe fn get_function(&self, id: FnId) -> Optional<CBaseFn>; unsafe fn lock(&self); unsafe fn try_lock(&self) -> Bool; unsafe fn unlock(&self); unsafe fn get_sync_handler(&self) -> NonNullConst<SyncHandlerInterface>; unsafe fn set_sync_handler(
&mut self,
handler: Option<NonNullConst<SyncHandlerInterface>>
); }
Helper trait for using the sys api.
Required methods
unsafe fn shutdown(&mut self) -> !
[src]
unsafe fn panic(&self, error: Option<NonNullConst<u8>>) -> !
[src]
Execution of the program is stopped abruptly. The error may be logged.
Safety
The function crosses the ffi boundary.
unsafe fn has_function(&self, id: FnId) -> Bool
[src]
Checks if a function is implemented.
Return
Bool::True if the function exists, Bool::False otherwise.
Safety
The function crosses the ffi boundary.
unsafe fn get_function(&self, id: FnId) -> Optional<CBaseFn>
[src]
Fetches a function from the interface.
Return
Function pointer to the requested function, if it exists.
Safety
The function crosses the ffi boundary.
unsafe fn lock(&self)
[src]
Locks the interface.
The calling thread is stalled until the lock can be acquired. Only one thread can hold the lock at a time.
Safety
The function crosses the ffi boundary.
unsafe fn try_lock(&self) -> Bool
[src]
Tries to lock the interface.
The function fails if another thread already holds the lock.
Return
Bool::True on success and Bool::False otherwise.
Safety
The function crosses the ffi boundary.
unsafe fn unlock(&self)
[src]
Unlocks the interface.
Safety
The function crosses the ffi boundary. Trying to call this function without prior locking is undefined behaviour.
unsafe fn get_sync_handler(&self) -> NonNullConst<SyncHandlerInterface>
[src]
Fetches the active synchronization handler.
Return
Pointer to the active synchronization handler.
Safety
The function is not thread-safe and crosses the ffi boundary.
unsafe fn set_sync_handler(
&mut self,
handler: Option<NonNullConst<SyncHandlerInterface>>
)
[src]
&mut self,
handler: Option<NonNullConst<SyncHandlerInterface>>
)
Sets a new synchronization handler.
The default synchronization handler is used, if handler
is Option::None.
Uses
This function can be used by modules, that want to provide a more complex synchronization mechanism than the one presented by the default handler.
Swapping
The swapping occurs in three steps:
- The new synchronization handler is locked.
- The new synchronization handler is set as the active synchronization handler.
- The old synchronization handler is unlocked.
Note
Changing the synchronization handler may break some modules, if they depend on a specific synchronization handler.
Safety
The function is not thread-safe and crosses the ffi boundary.
Implementors
impl SysBinding for CBaseInterface
[src]
impl SysBinding for CBaseInterface
[src]unsafe fn shutdown(&mut self) -> !
[src]
unsafe fn panic(&self, error: Option<NonNullConst<u8>>) -> !
[src]
unsafe fn has_function(&self, id: FnId) -> Bool
[src]
unsafe fn get_function(&self, id: FnId) -> Optional<CBaseFn>
[src]
unsafe fn lock(&self)
[src]
unsafe fn try_lock(&self) -> Bool
[src]
unsafe fn unlock(&self)
[src]
unsafe fn get_sync_handler(&self) -> NonNullConst<SyncHandlerInterface>
[src]
unsafe fn set_sync_handler(
&mut self,
handler: Option<NonNullConst<SyncHandlerInterface>>
)
[src]
&mut self,
handler: Option<NonNullConst<SyncHandlerInterface>>
)