| Iris Manual | ||||
|---|---|---|---|---|
| Top | Description | ||||
#define IRIS_TYPE_RROBIN IrisRRobin; GType iris_rrobin_get_type (void); IrisRRobin* iris_rrobin_new (gint size); IrisRRobin* iris_rrobin_ref (IrisRRobin *rrobin); void iris_rrobin_unref (IrisRRobin *rrobin); gboolean iris_rrobin_append (IrisRRobin *rrobin, gpointer data); void iris_rrobin_remove (IrisRRobin *rrobin, gpointer data); gboolean iris_rrobin_apply (IrisRRobin *rrobin, IrisRRobinFunc callback, gpointer user_data); void iris_rrobin_foreach (IrisRRobin *rrobin, IrisRRobinForeachFunc callback, gpointer user_data);
IrisRRobin is a structure used for implementing round-robin semantics.
To use it, call iris_rrobin_append() including the data for each slot
in your round-robin. After that, you may use iris_rrobin_apply() to
perform a callback using the next data-slot.
IrisRRobin* iris_rrobin_new (gint size);
Creates a new instance of the lock-free, round-robin data structure.
|
The maximum number of entries |
Returns : |
the new IrisRRobin instance |
IrisRRobin* iris_rrobin_ref (IrisRRobin *rrobin);
Increments the reference count of rrobin atomically by one.
|
An IrisRRobin |
Returns : |
The rrobin instance with its reference count incremented.
|
void iris_rrobin_unref (IrisRRobin *rrobin);
Atomically decreates the reference count of rrobin. If the reference
count reaches zero, teh object is destroyed and all its allocated
resources are freed.
|
An IrisRRobin |
gboolean iris_rrobin_append (IrisRRobin *rrobin, gpointer data);
Appends a new data item to the round-robin structure. The data supplied
will be added to the arguments of the callback used in iris_rrobin_apply().
|
An IrisRRobin |
|
a gpointer to callback data |
Returns : |
TRUE if there was enough free-space to append the item.
|
void iris_rrobin_remove (IrisRRobin *rrobin, gpointer data);
Removes the first instance of data within the rrobin structure.
|
An IrisRRobin |
|
a gpointer to callback data |
gboolean iris_rrobin_apply (IrisRRobin *rrobin, IrisRRobinFunc callback, gpointer user_data);
Executes callback using the data from the next item in the round-robin
data structure.
|
An IrisRRobin |
|
An IrisRRobinFunc to execute |
|
user data supplied to callback |
Returns : |
FALSE if no items where in the IrisRRobin, else TRUE.
|
void iris_rrobin_foreach (IrisRRobin *rrobin, IrisRRobinForeachFunc callback, gpointer user_data);
Executes callback for each item in the IrisRRobin structure. If
callback returns FALSE, then iteration is stopped and the method
will return.
|
An IrisRRobin |
|
An IrisRRobinForeachFunc |
|
user data supplied to callback
|