Struct conch_runtime::env::ThreadPoolAsyncIoEnv
[−]
[src]
pub struct ThreadPoolAsyncIoEnv { /* fields omitted */ }An AsyncIoEnvironment implementation that uses a threadpool for doing
reads and writes on synchronous/blocking FileDesc handles.
This is a pretty costly implementation which may be required on systems that do not support asynchronous read/write operations (easily or at all). If running on a system that supports more efficient async operations, it is strongly encouraged to use an alternative implementation.
Note: Caller should ensure that any
FileDeschandles passed into this environment are not configured for asynchronous operations, otherwise operations will fail with aWouldBlockerror. This is done to avoid burning CPU cycles while spinning on read/write operations.
Methods
impl ThreadPoolAsyncIoEnv[src]
fn new(size: usize) -> Self[src]
Creates a new thread pool with size worker threads associated with it.
fn new_num_cpus() -> Self[src]
Creates a new thread pool with a number of workers equal to the number of CPUs on the host.
Trait Implementations
impl Clone for ThreadPoolAsyncIoEnv[src]
fn clone(&self) -> ThreadPoolAsyncIoEnv[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)1.0.0[src]
Performs copy-assignment from source. Read more
impl SubEnvironment for ThreadPoolAsyncIoEnv[src]
fn sub_env(&self) -> Self[src]
Create a new sub-environment, which starts out idential to its parent, but any changes on the new environment will not be reflected on the parent. Read more
impl Debug for ThreadPoolAsyncIoEnv[src]
impl AsyncIoEnvironment for ThreadPoolAsyncIoEnv[src]
type Read = ReadAsync
An async/futures-aware Read adapter around a FileDesc.
type WriteAll = CpuFuture<(), IoError>
An future that represents writing data into a FileDesc.
fn read_async(&mut self, fd: FileDesc) -> Self::Read[src]
Creates a futures-aware adapter to read data from a FileDesc asynchronously.
fn write_all(&mut self, fd: FileDesc, data: Vec<u8>) -> Self::WriteAll[src]
Creates a future for writing data into a FileDesc.
fn write_all_best_effort(&mut self, fd: FileDesc, data: Vec<u8>)[src]
Asynchronously write the contents of data to a FileDesc in the background on a best effort basis (e.g. the implementation can give up due to any (appropriately) unforceen errors like broken pipes). Read more