Main Page | Modules | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages

cqueue Struct Reference

#include <cq.h>


Detailed Description

Callout queue descriptor.

A callout queue is really a sorted linked list of events that are to happen in the near future, most recent coming first.

Naturally, the insertion/deletion of items has to be relatively efficient. We don't want to go through all the items in the list to find the proper position for insertion.

To do that, we maintain a parallel hash list of all the events, each event being inserted in the bucket i, where i is computed by abs_time size, abs_time being the absolute time where the event is to be triggered and size being the size of the hash list. All the items under the bucket list are further sorted by increasing trigger time.

To be completely generic, the callout queue "absolute time" is a mere unsigned long value. It can represent an amount of ms, or an amount of yet-to-come messages, or whatever. We don't care, and we don't want to care. The notion of "current time" is simply given by calling cq_clock() at regular intervals and giving it the "elasped time" since the last call.


Data Fields

chashcq_hash
 Array of buckets for hash list.

time_t cq_time
 "current time"

gint cq_ticks
 Number of cq_clock() calls processed.

gint cq_items
 Amount of recorded events.

gint cq_last_bucket
 Last bucket slot we were at.

chashcq_current
 Current bucket scanned in cq_clock().


Field Documentation

struct chash* cqueue::cq_current
 

Current bucket scanned in cq_clock().

struct chash* cqueue::cq_hash
 

Array of buckets for hash list.

gint cqueue::cq_items
 

Amount of recorded events.

gint cqueue::cq_last_bucket
 

Last bucket slot we were at.

gint cqueue::cq_ticks
 

Number of cq_clock() calls processed.

time_t cqueue::cq_time
 

"current time"


The documentation for this struct was generated from the following file:
Generated on Sun Feb 12 10:50:11 2006 for Gtk-Gnutella by doxygen 1.3.6