[sgen] Add free lists for each workers
[mono-project.git] / mono / sgen / sgen-workers.h
blob7c6c2fc34d1e98a45b71b106efd41dd0c450cab9
1 /*
2 * sgen-workers.c: Worker threads for parallel and concurrent GC.
4 * Copyright 2011 Xamarin Inc (http://www.xamarin.com)
5 * Copyright (C) 2012 Xamarin Inc
7 * Licensed under the MIT license. See LICENSE file in the project root for full license information.
8 */
10 #ifndef __MONO_SGEN_WORKER_H__
11 #define __MONO_SGEN_WORKER_H__
13 #include "mono/sgen/sgen-thread-pool.h"
15 typedef struct _WorkerData WorkerData;
16 struct _WorkerData {
17 gint32 state;
18 SgenGrayQueue private_gray_queue; /* only read/written by worker thread */
20 * Workers allocate major objects only from here. It has same structure as the
21 * global one. This is normally accessed from the worker_block_free_list_key.
22 * We hold it here so we can clear free lists from all threads before sweep
23 * starts.
25 gpointer free_block_lists;
28 typedef void (*SgenWorkersFinishCallback) (void);
29 typedef void (*SgenWorkerCallback) (WorkerData *data);
31 void sgen_workers_init (int num_workers, SgenWorkerCallback callback);
32 void sgen_workers_stop_all_workers (void);
33 void sgen_workers_start_all_workers (SgenObjectOperations *object_ops, SgenWorkersFinishCallback finish_job);
34 void sgen_workers_init_distribute_gray_queue (void);
35 void sgen_workers_enqueue_job (SgenThreadPoolJob *job, gboolean enqueue);
36 void sgen_workers_wait_for_jobs_finished (void);
37 void sgen_workers_distribute_gray_queue_sections (void);
38 void sgen_workers_reset_data (void);
39 void sgen_workers_join (void);
40 gboolean sgen_workers_have_idle_work (void);
41 gboolean sgen_workers_all_done (void);
42 gboolean sgen_workers_are_working (void);
43 void sgen_workers_assert_gray_queue_is_empty (void);
44 void sgen_workers_take_from_queue_and_awake (SgenGrayQueue *queue);
45 SgenObjectOperations* sgen_workers_get_idle_func_object_ops (void);
46 int sgen_workers_get_job_split_count (void);
47 void sgen_workers_foreach (SgenWorkerCallback callback);
49 #endif