Teek::BackgroundRactor4x::BackgroundWork::TaskContext Class
Context object passed to the worker block inside the Ractor. Provides methods for yielding results, sending/receiving messages, and responding to pause/stop signals.
Inherits: Object
Instance Methods ↑
check_message
Non-blocking check for a message from the main thread.
Handles built-in control messages (:pause, :resume, :stop)
automatically; :stop raises StopIteration.
Returns Object, nil — the message, or nil if none pending
check_pause
Block while paused, returning immediately if not paused. Call this periodically in long-running loops to honor pause requests.
send_message(msg)
Send a custom message back to the main thread.
Arrives in the BackgroundWork#on_message callback.
Parameters
msgObject— any Ractor-shareable value
wait_message
Blocking wait for the next message from the main thread. Handles control messages automatically.
Returns Object — the message
yield(value)
Send a result to the main thread. Blocks while paused.
The value arrives in the BackgroundWork#on_progress callback.
Parameters
valueObject— any Ractor-shareable value