00001 #ifndef _JOB_QUEUE_H_ 00002 #define _JOB_QUEUE_H_ 00003 00004 typedef void (*FuncPtr)(void *,void *); 00005 00006 /* job_queue node structure */ 00007 typedef struct node{ 00008 FuncPtr fp; /* pointer to function */ 00009 void * args; /* functioin arguements */ 00010 struct node * next; 00011 } node; 00012 00013 /* queue_queue structure */ 00014 typedef struct{ 00015 node * head; 00016 int size; 00017 pthread_mutex_t access; 00018 pthread_cond_t empty; 00019 } List; 00020 00021 typedef struct{ 00022 void * state; 00023 void * msg; 00024 } JobArgs; 00025 00026 00032 void * job_exec(void *job_q); 00033 00034 00041 void job_submit(List *job_q,FuncPtr func,void* args,int args_size); 00042 00043 00044 00050 List * job_queue_init(int pool_size); 00051 00052 #endif