Lely core libraries
2.3.4
|
This header file is part of the I/O library; it contains the timer queue declarations. More...
Go to the source code of this file.
Data Structures | |
struct | io_tqueue_wait |
A wait operation suitable for use with a timer queue. More... | |
Macros | |
#define | IO_TQUEUE_WAIT_INIT(sec, nsec, exec, func) |
The static initializer for io_tqueue_wait. | |
Typedefs | |
typedef struct io_tqueue | io_tqueue_t |
A timer queue. | |
Functions | |
io_tqueue_t * | io_tqueue_create (io_timer_t *timer, ev_exec_t *exec) |
Creates a new timer queue. More... | |
void | io_tqueue_destroy (io_tqueue_t *tq) |
Destroys a timer queue. More... | |
io_dev_t * | io_tqueue_get_dev (const io_tqueue_t *tq) |
Returns a pointer to the abstract I/O device representing the timer queue. | |
io_timer_t * | io_tqueue_get_timer (const io_tqueue_t *tq) |
Returns a pointer to the I/O timer used by the timer queue. | |
void | io_tqueue_submit_wait (io_tqueue_t *tq, struct io_tqueue_wait *wait) |
Submits a wait operation to a timer queue. More... | |
size_t | io_tqueue_cancel_wait (io_tqueue_t *tq, struct io_tqueue_wait *wait) |
Cancels the specified timer queue wait operation if it is pending. More... | |
size_t | io_tqueue_abort_wait (io_tqueue_t *tq, struct io_tqueue_wait *wait) |
Aborts the specified timer queue wait operation if it is pending. More... | |
ev_future_t * | io_tqueue_async_wait (io_tqueue_t *tq, ev_exec_t *exec, const struct timespec *value, struct io_tqueue_wait **pwait) |
Submits an asynchronous wait operation to a timer queue and creates a future which becomes ready once the wait operation completes (or is canceled). More... | |
struct io_tqueue_wait * | io_tqueue_wait_from_task (struct ev_task *task) |
Obtains a pointer to a timer queue wait operation from a pointer to its completion task. | |
This header file is part of the I/O library; it contains the timer queue declarations.
A timer queue allows multiple non-periodic wait operations with different expiration times to use the same I/O timer. This is much more efficient than creating a separate I/O timer for each concurrent wait.
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 tqueue.h.
io_tqueue_t* io_tqueue_create | ( | io_timer_t * | timer, |
ev_exec_t * | exec | ||
) |
Creates a new timer queue.
timer | a pointer to the I/O timer to be used for the queue. During the lifetime of the timer queue, io_timer_settime() MUST NOT be invoked. |
exec | a pointer to the executor used to execute asynchronous tasks. If exec is NULL, the executor of the I/O timer is used. |
void io_tqueue_destroy | ( | io_tqueue_t * | tq | ) |
void io_tqueue_submit_wait | ( | io_tqueue_t * | tq, |
struct io_tqueue_wait * | wait | ||
) |
size_t io_tqueue_cancel_wait | ( | io_tqueue_t * | tq, |
struct io_tqueue_wait * | wait | ||
) |
Cancels the specified timer queue wait operation if it is pending.
The completion task is submitted for execution with errc = errnum2c(ERRNUM_CANCELED).
size_t io_tqueue_abort_wait | ( | io_tqueue_t * | tq, |
struct io_tqueue_wait * | wait | ||
) |
Aborts the specified timer queue wait operation if it is pending.
If aborted, the completion task is not submitted for execution.
ev_future_t* io_tqueue_async_wait | ( | io_tqueue_t * | tq, |
ev_exec_t * | exec, | ||
const struct timespec * | value, | ||
struct io_tqueue_wait ** | pwait | ||
) |
Submits an asynchronous wait operation to a timer queue and creates a future which becomes ready once the wait operation completes (or is canceled).
The result of the future is an int
containing the error number.
tq | a pointer to a timer queue. |
exec | a pointer to the executor used to execute the completion function of the wait operation. If NULL, the default executor of the timer queue is used. |
value | a pointer to the absolute expiration time. |
pwait | the address at which to store a pointer to the wait operation (can be NULL). |