Thread Per-Request (Cont.) First, the data structures. /* struct used to hold data about the active threads. */ struct active_threads { pthread_mutex_t mutex; /* protect data in the struct. */ pthread_cond_t cond; /* for notifying of dying threads. */ int num_threads; /* number of active threads. */ int max_num_threads; /* max active threads that may be. */ }; /* struct used to pass data to a request processing thread. */ struct handler_thread_data { struct active_threads* threads; struct request* request; }; /* struct for the manager thread. */ struct mgr_thread_data { struct active_threads* threads; struct request_queue* q; int* should_exit; };