priority_list.h File Reference

#include "common.h"
#include "config.h"
#include "collection.h"
#include "linked_list.h"

Go to the source code of this file.

Data Structures

struct  _cp_priority_list


#define cp_priority_list_create(immediate, normal_priorities, weights)
#define cp_priority_list_get_next(l)   cp_priority_list_get_next_by_option((l), (l)->mode)
#define cp_priority_list_rdlock(list)   cp_priority_list_lock(list, COLLECTION_LOCK_READ)
#define cp_priority_list_wrlock(list)   cp_priority_list_lock(list, COLLECTION_LOCK_WRITE)


typedef CPROPS_DLL struct


cp_priority_list * cp_priority_list_create_by_option (int immediate, int normal_priority_queues, int *weight, cp_compare_fn compare_fn, cp_copy_fn copy_fn, cp_destructor_fn item_destructor, int mode)
void cp_priority_list_destroy (cp_priority_list *list)
void cp_priority_list_destroy_by_option (cp_priority_list *list, int mode)
void * cp_priority_list_insert (cp_priority_list *list, void *item, int priority)
void * cp_priority_list_insert_by_option (cp_priority_list *list, void *item, int priority, int mode)
void * cp_priority_list_get_next_by_option (cp_priority_list *list, int mode)
int cp_priority_list_is_empty (cp_priority_list *list)
int cp_priority_list_lock (cp_priority_list *list, int type)
int cp_priority_list_unlock (cp_priority_list *list)
long cp_priority_list_item_count (cp_priority_list *list)

Detailed Description

push your data on a cp_priority_list then retrieve them by priority. priority levels are 0 - immediate: a priority list instantiated with an immediate priority will only return immediate priority items as long as such items are present on the immediate priority sub queue. 1 - the first 'normal priority' subqueue defined. Subqueues are defined with a weight. If you define the first subqueue with say weight 2 and the second with 1, in the absence of an immediate priority subqueue, calling cp_priority_list_get_next will return 2 items from the queue with weight 2, then 1 item from the queue with weight 1. Do not confuse the subqueue index, which is used to determine which queue you push items on (ie, what 'priority' they receive) with the actual weights. You could easily construct a cp_priority_list where priority 1 items have a lower weight than priority 2 items and vice versa.

Definition in file priority_list.h.

Generated on Mon Dec 5 23:00:22 2011 for cprops by  doxygen 1.4.7