/*************************************************************************
* *
* Export: procqueue.e *
* *
* realizzato dal Gruppo 17 di Lab2 Anno Accademico 1995/96 *
* *
* Lorenzo Claudio Valerio Riccardo Emiliano *
* Coronati Lanconelli Paolini Solmi Trentini *
* *
**************************************************************************/
#ifndef _PROCQ_E
#define _PROCQ_E
#include "types.h"
#include "proctree.h"
extern proc_t *remRdyQueue();
extern proc_t *outRdyQueue(/* proc_t *proc */);
extern thr_t *outWaitThread(/* thr_t **tp, thr_t *thread */);
#define EMPTYQUEUE(q) ((q) == NULL)
#define NEXTRDYQUEUE() \
{\
ready_queue = ready_queue->p_nextready;\
run_proc = ready_queue->p_nextready;\
}
#define NEXTRDYTHREAD(q) \
{\
(q) = (q)->t_next;\
run_thread = (q)->t_next;\
}
#define insRdyQueue(proc) \
{ \
if (ready_queue == NULL) \
ready_queue = proc->p_nextready = proc; \
else \
{ \
proc->p_nextready = ready_queue->p_nextready; \
ready_queue = ready_queue->p_nextready = proc; \
} \
}
#define insWaitThread(tp, thread) \
{ \
if (*(tp) == NULL) \
*(tp) = (thread)->t_nextwait = thread; \
else \
{ \
(thread)->t_nextwait = (*(tp))->t_nextwait; \
(*(tp))->t_nextwait = thread; \
} \
}
#endif