Struct miow::iocp::CompletionPort
[−]
[src]
pub struct CompletionPort { /* fields omitted */ }
A handle to an Windows I/O Completion Port.
Methods
impl CompletionPort
[src]
fn new(threads: u32) -> Result<CompletionPort>
Creates a new I/O completion port with the specified concurrency value.
The number of threads given corresponds to the level of concurrency allowed for threads associated with this port. Consult the Windows documentation for more information about this value.
fn add_handle<T: AsRawHandle + ?Sized>(&self, token: usize, t: &T) -> Result<()>
Associates a new HANDLE
to this I/O completion port.
This function will associate the given handle to this port with the
given token
to be returned in status messages whenever it receives a
notification.
Any object which is convertible to a HANDLE
via the AsRawHandle
trait can be provided to this function, such as std::fs::File
and
friends.
fn add_socket<T: AsRawSocket + ?Sized>(&self, token: usize, t: &T) -> Result<()>
Associates a new SOCKET
to this I/O completion port.
This function will associate the given socket to this port with the
given token
to be returned in status messages whenever it receives a
notification.
Any object which is convertible to a SOCKET
via the AsRawSocket
trait can be provided to this function, such as std::net::TcpStream
and friends.
fn get(&self, timeout_ms: Option<u32>) -> Result<CompletionStatus>
Dequeue a completion status from this I/O completion port.
This function will associate the calling thread with this completion port and then wait for a status message to become available. The precise semantics on when this function returns depends on the concurrency value specified when the port was created.
A timeout (in milliseconds) can optionally be specified to this
function. If None
is provided this function will not time out, and
otherwise it will time out after the specified duration has passed.
On success this will return the status message which was dequeued from this completion port.
fn get_many<'a>(&self,
list: &'a mut [CompletionStatus],
timeout_ms: Option<u32>)
-> Result<&'a mut [CompletionStatus]>
list: &'a mut [CompletionStatus],
timeout_ms: Option<u32>)
-> Result<&'a mut [CompletionStatus]>
Dequeues a number of completion statuses from this I/O completion port.
This function is the same as get
except that it may return more than
one status. A buffer of "zero" statuses is provided (the contents are
not read) and then on success this function will return a sub-slice of
statuses which represent those which were dequeued from this port. This
function does not wait to fill up the entire list of statuses provided.
Like with get
, a timeout may be specified for this operation.
fn post(&self, status: CompletionStatus) -> Result<()>
Posts a new completion status onto this I/O completion port.
This function will post the given status, with custom parameters, to the
port. Threads blocked in get
or get_many
will eventually receive
this status.
Trait Implementations
impl Debug for CompletionPort
[src]
impl AsRawHandle for CompletionPort
[src]
fn as_raw_handle(&self) -> HANDLE
Extracts the raw handle, without taking any ownership.
impl FromRawHandle for CompletionPort
[src]
unsafe fn from_raw_handle(handle: HANDLE) -> CompletionPort
Constructs a new I/O object from the specified raw handle. Read more
impl IntoRawHandle for CompletionPort
[src]
fn into_raw_handle(self) -> HANDLE
Consumes this object, returning the raw underlying handle. Read more