#include "common.h"
Go to the source code of this file.
Typedefs | |
| typedef cqueue | cqueue_t |
| typedef cevent | cevent_t |
| typedef void(* | cq_service_t )(struct cqueue *cq, gpointer udata) |
| typedef guint64 | cq_time_t |
| Virtual time for callout queue. | |
Functions | |
| gdouble | callout_queue_coverage (gint old_ticks) |
| Returns percentage of coverage of the callout timer, i.e. | |
| void | cq_init (void) |
| Initialization. | |
| void | cq_close (void) |
| Final cleanup. | |
| cqueue_t * | cq_make (cq_time_t now) |
| Create a new callout queue object. | |
| void | cq_free (cqueue_t *cq) |
| Free the callout queue and all contained event objects. | |
| cevent_t * | cq_insert (cqueue_t *cq, gint delay, cq_service_t fn, gpointer arg) |
| Insert a new event in the callout queue and return an opaque handle that can be used to cancel the event. | |
| void | cq_expire (cqueue_t *cq, cevent_t *ev) |
| Expire timeout by removing it out of the queue and firing its callback. | |
| void | cq_cancel (cqueue_t *cq, cevent_t **handle_ptr) |
| Cancel a recorded timeout. | |
| void | cq_resched (cqueue_t *cq, cevent_t *handle, gint delay) |
| Reschedule event at some other point in time. | |
| void | cq_clock (cqueue_t *cq, gint elapsed) |
| The heartbeat of our callout queue. | |
| gint | cq_ticks (cqueue_t *cq) |
Variables | |
| cqueue_t * | callout_queue |
|
|
|
|
|
|
|
|
Virtual time for callout queue.
|
|
|
|
|
|
Returns percentage of coverage of the callout timer, i.e. the real amount of ticks we processed divided by the theoretical number, yielding a number between 0.0 and 1.0.
|
|
||||||||||||
|
Cancel a recorded timeout. They give us the opaque handle we returned via cq_insert().
|
|
||||||||||||
|
The heartbeat of our callout queue. Called to notify us about the elapsed "time" so that we can expire timeouts and maintain our notion of "current time". NB: The time maintained by the callout queue is "virtual". It's the elapased delay given by regular calls to cq_clock() that define its unit. For gtk-gnutella, the time unit is the millisecond. |
|
|
Final cleanup.
|
|
||||||||||||
|
Expire timeout by removing it out of the queue and firing its callback.
|
|
|
Free the callout queue and all contained event objects.
|
|
|
Initialization.
|
|
||||||||||||||||||||
|
Insert a new event in the callout queue and return an opaque handle that can be used to cancel the event. The event is specified to occur in some "delay" amount of time, at which time we shall call fn(cq, arg), where cq is the callout queue from where we triggered, and arg is an additional argument.
|
|
|
Create a new callout queue object. The 'now' parameter is used to initialize the "current time". Use zero if you don't care... |
|
||||||||||||||||
|
Reschedule event at some other point in time. It is the responsibility of the user code to determine that the handle for the event has not yet expired, i.e. that the event has not triggered yet. |
|
|
|
|
|
|
1.3.9.1