2 * sgen-thread-pool.h: Threadpool for all concurrent GC work.
4 * Copyright (C) 2015 Xamarin Inc
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public
8 * License 2.0 as published by the Free Software Foundation;
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details.
15 * You should have received a copy of the GNU Library General Public
16 * License 2.0 along with this library; if not, write to the Free
17 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 #ifndef __MONO_SGEN_THREAD_POOL_H__
21 #define __MONO_SGEN_THREAD_POOL_H__
23 typedef struct _SgenThreadPoolJob SgenThreadPoolJob;
25 typedef void (*SgenThreadPoolJobFunc) (SgenThreadPoolJob *job);
27 struct _SgenThreadPoolJob {
28 SgenThreadPoolJobFunc func;
29 volatile gint32 state;
32 void sgen_thread_pool_init (int num_threads);
34 void sgen_thread_pool_job_init (SgenThreadPoolJob *job, SgenThreadPoolJobFunc func);
35 void sgen_thread_pool_job_enqueue (SgenThreadPoolJob *job);
37 void sgen_thread_pool_wait_for_all_jobs (void);