#[repr(C)]pub struct EventLoops { /* private fields */ }
Expand description
The manager for EventLoop
.
Implementations§
Source§impl EventLoops
impl EventLoops
Sourcepub fn new(
event_loop_size: usize,
stack_size: usize,
min_size: usize,
max_size: usize,
keep_alive_time: u64,
) -> Result<Self>
pub fn new( event_loop_size: usize, stack_size: usize, min_size: usize, max_size: usize, keep_alive_time: u64, ) -> Result<Self>
Create a new EventLoops
.
Sourcepub fn submit_task(
name: Option<String>,
func: impl FnOnce(Option<usize>) -> Option<usize> + 'static,
param: Option<usize>,
priority: Option<c_longlong>,
) -> JoinHandle
pub fn submit_task( name: Option<String>, func: impl FnOnce(Option<usize>) -> Option<usize> + 'static, param: Option<usize>, priority: Option<c_longlong>, ) -> JoinHandle
Submit a new task to event-loop.
Allow multiple threads to concurrently submit task to the pool, but only allow one thread to execute scheduling.
Sourcepub fn try_cancel_task(name: &str)
pub fn try_cancel_task(name: &str)
Try to cancel a task from event-loop.
Sourcepub fn submit_co(
f: impl FnOnce(&Suspender<'_, (), ()>, ()) -> Option<usize> + 'static,
stack_size: Option<usize>,
priority: Option<c_longlong>,
) -> Result<()>
pub fn submit_co( f: impl FnOnce(&Suspender<'_, (), ()>, ()) -> Option<usize> + 'static, stack_size: Option<usize>, priority: Option<c_longlong>, ) -> Result<()>
Submit a new coroutine to event-loop.
Allow multiple threads to concurrently submit coroutine to the pool, but only allow one thread to execute scheduling.
Sourcepub fn wait_event(timeout: Option<Duration>) -> Result<()>
pub fn wait_event(timeout: Option<Duration>) -> Result<()>
Waiting for read or write events to occur. This method can only be used in coroutines.
Sourcepub fn wait_read_event(fd: c_int, timeout: Option<Duration>) -> Result<()>
pub fn wait_read_event(fd: c_int, timeout: Option<Duration>) -> Result<()>
Waiting for a read event to occur. This method can only be used in coroutines.
Sourcepub fn wait_write_event(fd: c_int, timeout: Option<Duration>) -> Result<()>
pub fn wait_write_event(fd: c_int, timeout: Option<Duration>) -> Result<()>
Waiting for a write event to occur. This method can only be used in coroutines.
Sourcepub fn del_event(fd: c_int) -> Result<()>
pub fn del_event(fd: c_int) -> Result<()>
Remove read and write event interests. This method can only be used in coroutines.
Sourcepub fn del_read_event(fd: c_int) -> Result<()>
pub fn del_read_event(fd: c_int) -> Result<()>
Remove read event interest. This method can only be used in coroutines.
Sourcepub fn del_write_event(fd: c_int) -> Result<()>
pub fn del_write_event(fd: c_int) -> Result<()>
Remove write event interest. This method can only be used in coroutines.