#[repr(i32)]pub enum ThreadModel {
SerializeConnections = 0,
SerializeAllRequests = 1,
SerializeRequests = 2,
Parallel = 3,
}
Expand description
A plugin’s maximum thread safety model
Variants§
SerializeConnections = 0
Only a single handle can be open at any time, and all requests happen from one thread.
SerializeAllRequests = 1
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 = 2
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 = 3
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 more