ocean.task.util.Timer

Collection of task waiting / timer utilities wrapped in an easy to use, pseudo-blocking API.

Uses a private static ocean.io.select.client.TimerSet instance for fiber resuming.

Usage example: See the documented unittest of the wait() function

Members

Functions

awaitOrTimeout
bool awaitOrTimeout(Task task, uint micro_seconds)

Similar to theScheduler.await but also has waiting timeout. Calling task will be resumed either if awaited task finished or timeout is hit, whichever happens first.

wait
void wait(uint micro_seconds)

Suspends the current fiber/task and resumes it again after micro_seconds microseconds.

Variables

timer
TaskTimerSet timer;

Implements timer event pool together with logic to handle arbitrary amount of events using single file descriptor. Allocated by registerResumeEvent on access.

Meta

License

Boost Software License Version 1.0. See LICENSE_BOOST.txt for details. Alternatively, this file may be distributed under the terms of the Tango 3-Clause BSD License (see LICENSE_BSD.txt for details).