Skip to main content

Module task

Module task 

Source
Expand description

Timer, thread, and async task management. Timer and thread management for asynchronous operations.

This module provides:

  • TimerId / ThreadId: Unique identifiers for timers and background threads
  • Instant / Duration: Cross-platform time types (works on no_std with tick counters)
  • ThreadReceiver: Channel for receiving messages from the main thread
  • Callback types for thread communication and system time queries

Structs§

CheckThreadFinishedCallback
Wrapper for thread completion check callback.
GetSystemTimeCallback
InstantPtr
FFI-safe wrapper around std::time::Instant with custom clone/drop callbacks.
InstantPtrCloneCallback
InstantPtrDestructorCallback
LibrarySendThreadMsgCallback
Wrapper for thread message send callback.
SystemTick
Tick-based timestamp for systems without a real-time clock.
SystemTickDiff
Represents a difference in ticks for systems that don’t support timing
SystemTimeDiff
Duration represented as seconds + nanoseconds (mirrors std::time::Duration).
ThreadId
ID for uniquely identifying a background thread
ThreadIdVec
ThreadIdVecSlice
C-compatible slice type for $struct_name. This is a non-owning view into a Vec’s data.
ThreadReceiver
Channel endpoint for receiving messages from the main thread in a background thread.
ThreadReceiverDestructorCallback
Wrapper for thread receiver destructor callback.
ThreadReceiverInner
Inner receiver state containing the actual channel and callbacks.
ThreadRecvCallback
Wrapper for thread message receive callback.
TimerId
ID for uniquely identifying a timer
TimerIdVec
TimerIdVecSlice
C-compatible slice type for $struct_name. This is a non-owning view into a Vec’s data.

Enums§

Duration
A span of time, either from the system clock or as tick difference.
Instant
A point in time, either from the system clock or a tick counter.
OptionDuration
OptionInstant
OptionThreadId
OptionThreadSendMsg
OptionTimerId
TerminateTimer
Should a timer terminate or not - used to remove active timers
ThreadIdVecDestructor
ThreadSendMsg
Message that can be sent from the main thread to the Thread using the ThreadId.
TimerIdVecDestructor

Constants§

CAPABILITY_PUMP_TIMER_ID
Timer ID for the single-threaded capability pump (MWA-A1).
CURSOR_BLINK_TIMER_ID
Timer ID for cursor blinking in contenteditable elements (~530ms interval)
DRAG_AUTOSCROLL_TIMER_ID
Timer ID for auto-scroll during drag operations near edges
LONG_PRESS_TIMER_ID
Timer ID for the one-shot long-press wake-up (MWA-B12).
SCROLL_MOMENTUM_TIMER_ID
Timer ID for scroll momentum/inertia animation
TOOLTIP_DELAY_TIMER_ID
Timer ID for tooltip show delay.
USER_TIMER_ID_START
First available ID for user-defined timers

Statics§

TEST_CLOCK_OFFSET_MS
Injectable test-clock offset, in milliseconds, added to every Instant::now().

Functions§

advance_test_clock_ms
Advance the injectable test clock by ms (E2E tick_ms).
get_system_time_libstd
Default implementation that gets the current system time.
test_clock_offset_ms
The current test-clock offset in ms (0 unless tick_ms was used).

Type Aliases§

CheckThreadFinishedCallbackType
Callback to check if a thread has finished execution.
GetSystemTimeCallbackType
Get the current system type, equivalent to std::time::Instant::now(), except it also works on systems that don’t have a clock (such as embedded timers)
InstantPtrCloneCallbackType
InstantPtrDestructorCallbackType
LibrarySendThreadMsgCallbackType
Callback to send a message to a background thread.
ThreadIdVecDestructorType
ThreadReceiverDestructorCallbackType
Callback to destroy a ThreadReceiver.
ThreadRecvCallbackType
Callback for a running thread to receive messages from the main thread.
TimerIdVecDestructorType