#[repr(C)]
pub struct SchedulerImpl<'s> { /* private fields */ }

Implementations§

source§

impl<'s> SchedulerImpl<'s>

source

pub fn new(name: String, stack_size: usize) -> Self

Trait Implementations§

source§

impl<'s> Current<'s> for SchedulerImpl<'s>

source§

fn init_current(current: &Self)
where Self: Sized,

Init the current.
source§

fn current() -> Option<&'s Self>
where Self: Sized,

Get the current if has.
source§

fn clean_current()
where Self: Sized,

clean the current.
source§

impl<'s> Debug for SchedulerImpl<'s>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for SchedulerImpl<'_>

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl Drop for SchedulerImpl<'_>

source§

fn drop(&mut self)

Executes the destructor for this type. Read more
source§

impl<'j> JoinHandle<SchedulerImpl<'j>> for JoinHandleImpl<'j>

source§

fn new(pool: *const SchedulerImpl<'j>, name: &str) -> Self

create JoinHandle instance.
source§

fn get_name(&self) -> Result<&str>

get the task name. Read more
source§

fn timeout_at_join( &self, timeout_time: u64 ) -> Result<Result<Option<usize>, &str>>

join with timeout. Read more
source§

fn err() -> Self
where Self: Sized,

create JoinHandle instance.
source§

fn timeout_join(&self, dur: Duration) -> Result<Result<Option<usize>, &str>>

join with Duration. Read more
source§

fn join(&self) -> Result<Result<Option<usize>, &str>>

join. Read more
source§

impl Listener for SchedulerImpl<'_>

source§

fn on_create(&self, coroutine: &SchedulableCoroutine<'_>)

callback when a coroutine is created. This will be called by Scheduler when a coroutine is created.
source§

fn on_schedule(&self, timeout_time: u64)

callback before scheduling coroutines. This will be called by Scheduler before scheduling coroutines.
source§

fn on_resume(&self, timeout_time: u64, coroutine: &SchedulableCoroutine<'_>)

callback before resuming the coroutine. This will be called by Scheduler before resuming the coroutine.
source§

fn on_suspend(&self, timeout_time: u64, coroutine: &SchedulableCoroutine<'_>)

callback when a coroutine is suspended. This will be called by Scheduler when a coroutine is suspended.
source§

fn on_syscall( &self, timeout_time: u64, coroutine: &SchedulableCoroutine<'_>, syscall: Syscall, state: SyscallState )

callback when a coroutine enters syscall. This will be called by Scheduler when a coroutine enters syscall.
source§

fn on_complete( &self, timeout_time: u64, coroutine: &SchedulableCoroutine<'_>, result: Option<usize> )

callback when a coroutine is completed. This will be called by Scheduler when a coroutine is completed.
source§

fn on_error( &self, timeout_time: u64, coroutine: &SchedulableCoroutine<'_>, message: &str )

callback when a coroutine is panic. This will be called by Scheduler when a coroutine is panic.
source§

impl Named for SchedulerImpl<'_>

source§

fn get_name(&self) -> &str

Get the name of this object.
source§

impl PartialEq for SchedulerImpl<'_>

source§

fn eq(&self, other: &Self) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<'s> Scheduler<'s, JoinHandleImpl<'s>> for SchedulerImpl<'s>

source§

fn get_stack_size(&self) -> usize

Get the default stack stack size for the coroutines in this scheduler. If it has not been set, it will be crate::constant::DEFAULT_STACK_SIZE.
source§

fn set_stack_size(&self, stack_size: usize)

Set the default stack stack size for the coroutines in this scheduler. If it has not been set, it will be crate::constant::DEFAULT_STACK_SIZE.
source§

fn submit_raw_co(&self, coroutine: SchedulableCoroutine<'static>) -> Result<()>

Submit a closure to create new coroutine, then the coroutine will be push into ready queue. Read more
source§

fn try_resume(&self, co_name: &str) -> Result<()>

Resume a coroutine from the system call table to the ready queue, it’s generally only required for framework level crates. Read more
source§

fn try_timeout_schedule(&self, timeout_time: u64) -> Result<u64>

Attempt to schedule the coroutines before the timeout_time timestamp. Read more
source§

fn try_get_co_result( &self, co_name: &str ) -> Option<Result<Option<usize>, &'s str>>

Attempt to obtain coroutine result with the given co_name.
source§

fn size(&self) -> usize

Returns the number of coroutines owned by this scheduler.
source§

fn add_listener(&mut self, listener: impl Listener + 's)

Add a listener to this scheduler.
source§

fn submit_co( &self, f: impl FnOnce(&dyn Suspender<'_, Resume = (), Yield = ()>, ()) -> Option<usize> + UnwindSafe + 'static, stack_size: Option<usize> ) -> Result<Join>

Submit a closure to create new coroutine, then the coroutine will be push into ready queue. Read more
source§

fn try_schedule(&self) -> Result<()>

Schedule the coroutines. Read more
source§

fn try_timed_schedule(&self, dur: Duration) -> Result<u64>

Try scheduling the coroutines for up to dur. Read more
source§

fn is_empty(&self) -> bool

Returns true if the ready queue, suspend queue, and syscall queue are all empty.
source§

impl Eq for SchedulerImpl<'_>

Auto Trait Implementations§

§

impl<'s> !RefUnwindSafe for SchedulerImpl<'s>

§

impl<'s> !Send for SchedulerImpl<'s>

§

impl<'s> !Sync for SchedulerImpl<'s>

§

impl<'s> Unpin for SchedulerImpl<'s>

§

impl<'s> !UnwindSafe for SchedulerImpl<'s>

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V