mdcore  0.1.5
Data Structures | Defines | Functions | Variables
/home/pedro/work/mdcore/src/queue.h File Reference

Go to the source code of this file.

Data Structures

struct  queue

Defines

#define queue_err_ok   0
#define queue_err_null   -1
#define queue_err_malloc   -2
#define queue_err_full   -3
#define queue_err_lock   -4
#define queue_flag_pairs   1
#define queue_flag_tuples   2

Functions

int queue_pairs_init (struct queue *q, int size, struct space *s, struct cellpair *pairs)
 Initialize a task queue with pairs.
int queue_tuples_init (struct queue *q, int size, struct space *s, struct celltuple *tuples)
 Initialize a task queue with tuples.
void queue_reset (struct queue *q)
 Reset the queue.
int queue_insert (struct queue *q, void *thing)
 Add an index to the given queue.
void * queue_get (struct queue *q, int rid, int keep)
 Get a task from the queue.

Variables

int queue_err

Define Documentation

#define queue_err_full   -3
#define queue_err_lock   -4
#define queue_err_malloc   -2
#define queue_err_null   -1
#define queue_err_ok   0
#define queue_flag_pairs   1
#define queue_flag_tuples   2

Function Documentation

void* queue_get ( struct queue q,
int  rid,
int  keep 
)

Get a task from the queue.

Parameters:
qThe queue.
ridrunner ID for ownership issues.
keepIf true, remove the returned index from the queue.
Returns:
A task (pair or tuple) with no unresolved conflicts or NULL if none could be found.
int queue_insert ( struct queue q,
void *  thing 
)

Add an index to the given queue.

Parameters:
qThe queue.
thingThe thing to be inserted.

Inserts a task into the queue at the location of the next pointer and moves all remaining tasks up by one. Thus, if the queue is executing, the inserted task is considered to already have been taken.

Returns:
1 on success, 0 if the queue is full and <0 on error (see queue_err).
int queue_pairs_init ( struct queue q,
int  size,
struct space s,
struct cellpair pairs 
)

Initialize a task queue with pairs.

Parameters:
qThe queue to initialize.
sizeThe maximum number of cellpairs in this queue.
sThe space with which this queue is associated.
pairsAn array containing the pairs to which the queue indices will refer to.
Returns:
queue_err_ok or <0 on error (see queue_err).

Initializes a queue of the maximum given size. The initial queue is empty and can be filled with pair ids.

See also:
queue_tuples_init
void queue_reset ( struct queue q)

Reset the queue.

Parameters:
qThe queue.
int queue_tuples_init ( struct queue q,
int  size,
struct space s,
struct celltuple tuples 
)

Initialize a task queue with tuples.

Parameters:
qThe queue to initialize.
sizeThe maximum number of cellpairs in this queue.
sThe space with which this queue is associated.
tuplesAn array containing the tuples to which the queue indices will refer to.
Returns:
queue_err_ok or <0 on error (see queue_err).

Initializes a queue of the maximum given size. The initial queue is empty and can be filled with tuple ids.

See also:
queue_tuples_init

Variable Documentation

int queue_err

ID of the last error

The ID of the last error.

 All Data Structures Files Functions Variables Typedefs Enumerator Defines