Lely core libraries
2.2.5
|
This header file is part of the I/O library; it contains the abstract timer interface. More...
#include <lely/ev/future.h>
#include <lely/ev/task.h>
#include <lely/io2/clock.h>
#include <lely/io2/dev.h>
Go to the source code of this file.
Data Structures | |
struct | io_timer_wait_result |
The result of an I/O timer wait operation. More... | |
struct | io_timer_wait |
A wait operation suitable for use with an I/O timer. More... | |
struct | io_timer_vtbl |
Macros | |
#define | IO_TIMER_WAIT_INIT(exec, func) |
The static initializer for io_timer_wait. | |
Typedefs | |
typedef const struct io_timer_vtbl *const | io_timer_t |
An abstract timer. | |
Functions | |
static io_ctx_t * | io_timer_get_ctx (const io_timer_t *timer) |
static ev_exec_t * | io_timer_get_exec (const io_timer_t *timer) |
static size_t | io_timer_cancel (io_timer_t *timer, struct ev_task *task) |
static size_t | io_timer_abort (io_timer_t *timer, struct ev_task *task) |
io_dev_t * | io_timer_get_dev (const io_timer_t *timer) |
Returns a pointer to the abstract I/O device representing the timer. | |
io_clock_t * | io_timer_get_clock (const io_timer_t *timer) |
Returns a pointer to the clock used by the timer. | |
int | io_timer_getoverrun (const io_timer_t *timer) |
Obtains the I/O timer expiration overrun count of the last successfully processed expiration. More... | |
int | io_timer_gettime (const io_timer_t *timer, struct itimerspec *value) |
Obtains the amount of time until the specified I/O timer expires and the reload value of the timer. More... | |
int | io_timer_settime (io_timer_t *timer, int flags, const struct itimerspec *value, struct itimerspec *ovalue) |
Arms or disarms an I/O timer. More... | |
void | io_timer_submit_wait (io_timer_t *timer, struct io_timer_wait *wait) |
Submits a wait operation to an I/O timer. More... | |
static size_t | io_timer_cancel_wait (io_timer_t *timer, struct io_timer_wait *wait) |
Cancels the specified I/O timer wait operation if it is pending. More... | |
static size_t | io_timer_abort_wait (io_timer_t *timer, struct io_timer_wait *wait) |
Aborts the specified I/O timer wait operation if it is pending. More... | |
ev_future_t * | io_timer_async_wait (io_timer_t *timer, ev_exec_t *exec, struct io_timer_wait **pwait) |
Submits an asynchronous wait operation to an I/O timer and creates a future which becomes ready once the wait operation completes (or is canceled). More... | |
struct io_timer_wait * | io_timer_wait_from_task (struct ev_task *task) |
Obtains a pointer to an I/O timer wait operation from a pointer to its completion task. | |
This header file is part of the I/O library; it contains the abstract timer interface.
The timer interface is modeled after the POSIX timer_getoverrun(), timer_gettime() and timer_settime() functions.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Definition in file timer.h.
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inline |
Obtains the I/O timer expiration overrun count of the last successfully processed expiration.
When a periodic timer expires but the event is not processed before the next expiration, a timer overrun occurs.
|
inline |
Obtains the amount of time until the specified I/O timer expires and the reload value of the timer.
timer | a pointer to an I/O timer. |
value | the address at which to store the timer values. On success, the the it_value member shall contain the time interval until the next expiration, or zero if the timer is disarmed. The it_interval member shall contain the reload value last set by io_timer_settime(). |
|
inline |
Arms or disarms an I/O timer.
timer | a pointer to an I/O timer. |
flags | if TIMER_ABSTIME is set in flags, the it_value member if *value contains the absolute time of the first expiration. If TIMER_ABSTIME is not set, the it_value member contains the time interval until the first expiration. |
value | a pointer to a struct containing the period of the timer in the it_interval member and the expiration in the it_value member. If the it_value member is zero, the timer is disarmed. If the it_interval member is non-zero, a periodic (or repetitive) timer is specified. The period MAY be rounded up to the nearest multiple of the clock resolution. |
ovalue | if not NULL, the address at which to store the previous amount of time until the timer would have expired, together with the previous reload value, as if by atomically calling io_timer_gettime() before this function. |
|
inline |
|
inlinestatic |
Cancels the specified I/O timer wait operation if it is pending.
The completion task is submitted for execution with result = -1 and errc = errnum2c(ERRNUM_CANCELED).
|
inlinestatic |
Aborts the specified I/O timer wait operation if it is pending.
If aborted, the completion task is not submitted for execution.
ev_future_t* io_timer_async_wait | ( | io_timer_t * | timer, |
ev_exec_t * | exec, | ||
struct io_timer_wait ** | pwait | ||
) |
Submits an asynchronous wait operation to an I/O timer and creates a future which becomes ready once the wait operation completes (or is canceled).
The result of the future has type io_timer_wait_result.
timer | a pointer to an I/O timer. |
exec | a pointer to the executor used to execute the completion function of the wait operation. If NULL, the default executor of the I/O timer is used. |
pwait | the address at which to store a pointer to the wait operation (can be NULL). |