thq.h revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
*
* Copyright %G% Sun Microsystems, Inc.
* All Rights Reserved
*
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <pthread.h>
typedef void * (*PFP)(void *);
typedef void * (*PFP2)(void *, void *);
typedef struct tq_listS {
void * arg;
typedef struct {
int * shutdown; /* variable to test to see shutdown condition*/
int shutalloc; /* is the shutdown variable allocated locally*/
int stopping; /* queue is currently stopping */
int queue_size; /* current size of the queue */
int nb_thr; /* current nb of threads pocessing the queue */
int thr_waiting; /* current nb of threads waiting */
int max_thr; /* max allowed threads to process the queue */
int min_thr; /* min nb of threads to keep alive */
void * func_arg, /* arg passed to both functions */
int * shutdown, /* shutdown variable to test */
int max, /* max allowed threads */
int min); /* min allowed threads */
void * arg); /* element to be queued */
/* tq_dequeue returns the first "arg" passed to tq_queue */
void * endit_arg); /* pointer to "shutdown" arguments */
/*
* tq_end_thread terminates the current
* thread and restarts a new one if necessary
*/
void * endit_arg); /* pointer to "shutdown" arguments */
/*
* tq_shutdown, shutdown the queue (alternate way to shutdown if you don't
* have a global shutdown integer
*
* shutdown can be immediate (1) or delayed until there is nothing more
* in the queue (immadiate = 0)
*
* when you call this function, no more argument can be queued using
* tq_queue.
*
* when tq_dequeue returns, the queue pointer is not allocated anymore
*
*/
int immediate); /* 1: don't wait, 0: wait for queue */
/* to be empty */