-typedef void (*SgenThreadPoolThreadInitFunc) (void*);
-typedef void (*SgenThreadPoolIdleJobFunc) (void*);
-typedef gboolean (*SgenThreadPoolContinueIdleJobFunc) (void);
+#define MAX_NUM_THREADS 8
+
+struct _SgenThreadPool {
+ mono_mutex_t lock;
+ mono_cond_t work_cond;
+ mono_cond_t done_cond;
+
+ int threads_num;
+ MonoNativeThreadId threads [MAX_NUM_THREADS];
+
+ /* Only accessed with the lock held. */
+ SgenPointerQueue job_queue;
+
+ SgenThreadPoolThreadInitFunc thread_init_func;
+ SgenThreadPoolIdleJobFunc idle_job_func;
+ SgenThreadPoolContinueIdleJobFunc continue_idle_job_func;
+ SgenThreadPoolShouldWorkFunc should_work_func;
+
+ volatile gboolean threadpool_shutdown;
+ volatile int threads_finished;
+};
+
+struct _SgenThreadPoolData {
+ SgenThreadPool *pool;
+};