/* copyright (c) 1996, 1997, 1998, 1999 William R. Pearson and the U. of Virginia */ /* modified to do more initialization of work_info here, rather than in main() */ /* $Name: fa_34_26_5 $ - $Id: pthr_subs2.c,v 1.9 2006/06/22 02:35:05 wrp Exp $ */ /* this file isolates the pthreads calls from the main program */ #include #include #include #include #include #include #include "defs.h" #include "structs.h" /* mngmsg, libstruct */ #include "param.h" /* pstruct, thr_str, buf_head, rstruct */ #include #define XTERNAL #include "thr.h" #undef XTERNAL #include "pthr_subs.h" extern void work_thread (struct thr_str *); /* start the threads working */ void init_thr(int nthreads, struct thr_str *work_info, struct mngmsg m_msg, struct pstruct *ppst, unsigned char *aa0, int max_work_buf) { int status, i; pthread_attr_t thread_attr; if (nthreads > MAX_WORKERS) { fprintf ( stderr," cannot start %d threads, max: %d\n", nthreads, MAX_WORKERS); exit(1); } /* set up work_info[] structure, set parameters */ for (i=0; i