mdcore
0.1.5
|
#include "../config.h"
#include <stdlib.h>
#include <stdio.h>
#include <pthread.h>
#include <math.h>
#include <float.h>
#include <string.h>
#include <limits.h>
#include "cycle.h"
#include "errs.h"
#include "fptype.h"
#include "lock.h"
#include "part.h"
#include "fifo.h"
#include "cell.h"
#include "space.h"
#include "potential.h"
#include "engine.h"
#include "queue.h"
Defines | |
#define | error(id) ( queue_err = errs_register( id , queue_err_msg[-(id)] , __LINE__ , __FUNCTION__ , __FILE__ ) ) |
Functions | |
void * | queue_get (struct queue *q, int rid, int keep) |
Get a task from the queue. | |
void | queue_reset (struct queue *q) |
Reset the queue. | |
int | queue_insert (struct queue *q, void *thing) |
Add an index to the given queue. | |
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. | |
Variables | |
int | queue_err = queue_err_ok |
unsigned int | queue_rcount = 0 |
char * | queue_err_msg [5] |
#define error | ( | id | ) | ( queue_err = errs_register( id , queue_err_msg[-(id)] , __LINE__ , __FUNCTION__ , __FILE__ ) ) |
int queue_insert | ( | struct queue * | q, |
void * | thing | ||
) |
Add an index to the given queue.
q | The queue. |
thing | The 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.
int queue_pairs_init | ( | struct queue * | q, |
int | size, | ||
struct space * | s, | ||
struct cellpair * | pairs | ||
) |
Initialize a task queue with pairs.
q | The queue to initialize. |
size | The maximum number of cellpairs in this queue. |
s | The space with which this queue is associated. |
pairs | An array containing the pairs to which the queue indices will refer to. |
Initializes a queue of the maximum given size. The initial queue is empty and can be filled with pair ids.
void queue_reset | ( | struct queue * | q | ) |
Reset the queue.
q | The queue. |
int queue_tuples_init | ( | struct queue * | q, |
int | size, | ||
struct space * | s, | ||
struct celltuple * | tuples | ||
) |
Initialize a task queue with tuples.
q | The queue to initialize. |
size | The maximum number of cellpairs in this queue. |
s | The space with which this queue is associated. |
tuples | An array containing the tuples to which the queue indices will refer to. |
Initializes a queue of the maximum given size. The initial queue is empty and can be filled with tuple ids.
int queue_err = queue_err_ok |
The ID of the last error.
char* queue_err_msg[5] |
{ "Nothing bad happened.", "An unexpected NULL pointer was encountered.", "A call to malloc failed, probably due to insufficient memory.", "Attempted to insert into a full queue.", "An error occured in a lock function." }
unsigned int queue_rcount = 0 |