Struct quickjs_runtime::utils::single_threaded_event_queue::SingleThreadedEventQueue [−][src]
the EsEventQueue is a single threaded thread pool which is used to act as the only thread using an instance of a script runtime besides being able to add tasks from any thread by add_task a running task can add jobs to the current thread by calling add_task_from_worker those tasks need not impl the Send trait and there is no locking happening to add the task to the queue
Implementations
impl SingleThreadedEventQueue
[src]
pub fn new() -> Arc<Self>
[src]
pub fn shutdown(&self)
[src]
pub fn add_task<T: FnOnce() + Send + 'static>(&self, task: T)
[src]
add a task which will run asynchronously
pub fn async_task<T: FnOnce() -> R + Send + 'static, R: Send + 'static>(
&self,
task: T
) -> impl Future<Output = R>
[src]
&self,
task: T
) -> impl Future<Output = R>
pub fn exe_task<R: Send + 'static, T: FnOnce() -> R + Send + 'static>(
&self,
task: T
) -> R
[src]
&self,
task: T
) -> R
execute a task synchronously in the worker thread
pub fn add_task_from_worker<T: FnOnce() + 'static>(&self, task: T)
[src]
method for adding tasks from worker, these do not need to impl Send also there is no locks we need to wait for
pub fn schedule_task_from_worker<T: Fn() + 'static>(
&self,
task: T,
interval: Option<Duration>,
delay: Duration
) -> i32
[src]
&self,
task: T,
interval: Option<Duration>,
delay: Duration
) -> i32
pub fn remove_schedule_task_from_worker(&self, id: i32)
[src]
pub fn todo_count(&self) -> usize
[src]
pub fn assert_is_worker_thread(&self)
[src]
Trait Implementations
impl Drop for SingleThreadedEventQueue
[src]
Auto Trait Implementations
impl !RefUnwindSafe for SingleThreadedEventQueue
impl Send for SingleThreadedEventQueue
impl Sync for SingleThreadedEventQueue
impl Unpin for SingleThreadedEventQueue
impl UnwindSafe for SingleThreadedEventQueue
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Pointable for T
pub const ALIGN: usize
type Init = T
The type for initializers.
pub unsafe fn init(init: <T as Pointable>::Init) -> usize
pub unsafe fn deref<'a>(ptr: usize) -> &'a T
pub unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T
pub unsafe fn drop(ptr: usize)
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,