Enum nbdkit::ThreadModel
source · #[repr(i32)]pub enum ThreadModel {
SerializeConnections,
SerializeAllRequests,
SerializeRequests,
Parallel,
}
Expand description
A plugin’s maximum thread safety model
Variants§
SerializeConnections
Only a single handle can be open at any time, and all requests happen from one thread.
SerializeAllRequests
Multiple handles can be open at the same time, but requests are serialized so that for the plugin as a whole only one open/read/write/close (etc) request will be in progress at any time.
This is a useful setting if the library you are using is not thread-safe. However performance may not be good.
SerializeRequests
Multiple handles can be open and multiple data requests can happen in parallel. However only one request will happen per handle at a time (but requests on different handles might happen concurrently).
Parallel
Multiple handles can be open and multiple data requests can happen in parallel (even on the same handle). The server may reorder replies, answering a later request before an earlier one.
All the libraries you use must be thread-safe and reentrant, and any
code that creates a file descriptor should atomically set FD_CLOEXEC
if you do not want it accidentally leaked to another thread’s child
process. You may also need to provide mutexes for fields in your
connection handle.
Trait Implementations§
source§impl Clone for ThreadModel
impl Clone for ThreadModel
source§fn clone(&self) -> ThreadModel
fn clone(&self) -> ThreadModel
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for ThreadModel
impl Debug for ThreadModel
source§impl PartialEq<ThreadModel> for ThreadModel
impl PartialEq<ThreadModel> for ThreadModel
source§fn eq(&self, other: &ThreadModel) -> bool
fn eq(&self, other: &ThreadModel) -> bool
self
and other
values to be equal, and is used
by ==
.