summaryrefslogtreecommitdiff
path: root/pthread_support.c
diff options
context:
space:
mode:
authorIvan Maidanski <ivmai@mail.ru>2022-05-20 21:41:52 +0300
committerIvan Maidanski <ivmai@mail.ru>2022-05-20 21:41:52 +0300
commit0d465ef3937b8680fe3bf4dd2149f3ab14ac8e9e (patch)
treed37a9a38e75f5bc025eb67404ca9ab862c979507 /pthread_support.c
parent1b4e5168adb06260bb9c439816a05ddb861dd7e0 (diff)
downloadbdwgc-0d465ef3937b8680fe3bf4dd2149f3ab14ac8e9e.tar.gz
Define GC_get_parallel and GC_set_markers_count in single-threaded GC
These are no-op definitions in case of the collector is built as a single-threaded one. This is useful for single threaded clients to be able to call these functions regardless of the collector is multi-threaded or not. * include/gc/gc.h [GC_THREADS] (GC_parallel): Reformat comment. * include/gc/gc.h (GC_get_parallel, GC_set_markers_count): Declare unconditionally. * misc.c [!PARALLEL_MARK] (GC_set_markers_count): Define (as no-op). * misc.c [!THREADS] (GC_get_parallel): Define (return 0). * pthread_support.c (GC_set_markers_count): Define only if PARALLEL_MARK; remove GC_ATTR_UNUSED. * win32_threads.c (GC_set_markers_count): Likewise. * tests/initfromthread.c (main): Call GC_get_suspend_signal() instead of GC_get_parallel().
Diffstat (limited to 'pthread_support.c')
-rw-r--r--pthread_support.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/pthread_support.c b/pthread_support.c
index b351b909..b78cf07f 100644
--- a/pthread_support.c
+++ b/pthread_support.c
@@ -1318,14 +1318,12 @@ static void fork_child_proc(void)
static unsigned required_markers_cnt = 0;
/* The default value (0) means the number of */
/* markers should be selected automatically. */
-#endif /* PARALLEL_MARK */
-GC_API void GC_CALL GC_set_markers_count(unsigned markers GC_ATTR_UNUSED)
-{
-# ifdef PARALLEL_MARK
+ GC_API void GC_CALL GC_set_markers_count(unsigned markers)
+ {
required_markers_cnt = markers < MAX_MARKERS ? markers : MAX_MARKERS;
-# endif
-}
+ }
+#endif /* PARALLEL_MARK */
GC_INNER void GC_thr_init(void)
{