00001 #ifndef QUEUEING_H
00002 #define QUEUEING_H
00003
00004
00014 #ifdef __cplusplus
00015 extern "C" {
00016 #endif
00017
00018
00020 extern int schedAdaptMemThresholdMB;
00021
00022 #ifndef CINTBITS
00023 #define CINTBITS ((unsigned int) (sizeof(int)*8))
00024 #endif
00025 #ifndef CLONGBITS
00026 #define CLONGBITS ((unsigned int) (sizeof(CmiInt8)*8))
00027 #endif
00028
00030 typedef struct prio_struct
00031 {
00032 unsigned short bits;
00033 unsigned short ints;
00034 unsigned int data[1];
00035 }
00036 *_prio;
00037
00042 typedef struct deq_struct
00043 {
00044
00045 void **bgn;
00046 void **end;
00047 void **head;
00048 void **tail;
00049 void *space[4];
00050 }
00051 *_deq;
00052
00053 #ifndef FASTQ
00054
00059 typedef struct prioqelt_struct
00060 {
00061 struct deq_struct data;
00062 struct prioqelt_struct *ht_next;
00063 struct prioqelt_struct **ht_handle;
00064 struct prio_struct pri;
00065 }
00066 *_prioqelt;
00067 #else
00068 typedef struct prioqelt_struct
00069 {
00070 struct deq_struct data;
00071 struct prioqelt_struct *ht_left;
00072 struct prioqelt_struct *ht_right;
00073 struct prioqelt_struct *ht_parent;
00074 struct prioqelt_struct **ht_handle;
00075 struct prio_struct pri;
00076
00077 }
00078 *_prioqelt;
00079 #endif
00080
00081
00082
00083
00084 #define PRIOQ_TABSIZE 1017
00085
00086
00087
00093 typedef struct prioq_struct
00094 {
00095 int heapsize;
00096 int heapnext;
00097 _prioqelt *heap;
00098 _prioqelt *hashtab;
00099 int hash_key_size;
00100 int hash_entry_size;
00101 }
00102 *_prioq;
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00123 typedef struct Queue_struct
00124 {
00125 unsigned int length;
00126 unsigned int maxlen;
00127 struct deq_struct zeroprio;
00128 struct prioq_struct negprioq;
00129 struct prioq_struct posprioq;
00130 }
00131 *Queue;
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00149 Queue CqsCreate(void);
00150
00152 void CqsDelete(Queue);
00153
00155 void CqsEnqueue(Queue, void *msg);
00156
00158 void CqsEnqueueFifo(Queue, void *msg);
00159
00161 void CqsEnqueueLifo(Queue, void *msg);
00162
00167 void CqsEnqueueGeneral(Queue, void *msg, int strategy,
00168 int priobits, unsigned int *prioPtr);
00169
00179 void CqsEnumerateQueue(Queue q, void ***resp);
00180
00185 void CqsDequeue(Queue, void **msgPtr);
00186
00187 unsigned int CqsLength(Queue);
00188 int CqsEmpty(Queue);
00189 int CqsPrioGT_(unsigned int ints1, unsigned int *data1, unsigned int ints2, unsigned int *data2);
00190 int CqsPrioGT(_prio, _prio);
00191
00193 _prio CqsGetPriority(Queue);
00194
00195 void CqsIncreasePriorityForEntryMethod(Queue q, const int entrymethod);
00196
00204 void CqsRemoveSpecific(Queue, const void *msgPtr);
00205
00206 #ifdef ADAPT_SCHED_MEM
00207 void CqsIncreasePriorityForMemCriticalEntries(Queue q);
00208 #endif
00209
00210 #ifdef __cplusplus
00211 }
00212 #endif
00213
00216 #endif