summaryrefslogtreecommitdiff
path: root/win32_threads.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 /win32_threads.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 'win32_threads.c')
-rw-r--r--win32_threads.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/win32_threads.c b/win32_threads.c
index 2a415ac7..96f82068 100644
--- a/win32_threads.c
+++ b/win32_threads.c
@@ -2505,6 +2505,12 @@ GC_INNER void GC_get_next_stack(char *start, char *limit,
static unsigned required_markers_cnt = 0;
/* The default value (0) means the number of */
/* markers should be selected automatically. */
+
+ GC_API void GC_CALL GC_set_markers_count(unsigned markers)
+ {
+ /* The same implementation as in pthread_support.c. */
+ required_markers_cnt = markers < MAX_MARKERS ? markers : MAX_MARKERS;
+ }
#endif /* PARALLEL_MARK */
/* We have no DllMain to take care of new threads. Thus we */
@@ -2742,14 +2748,6 @@ GC_INNER void GC_get_next_stack(char *start, char *limit,
#endif /* GC_WINMAIN_REDIRECT */
-GC_API void GC_CALL GC_set_markers_count(unsigned markers GC_ATTR_UNUSED)
-{
- /* The same implementation as in pthread_support.c. */
-# ifdef PARALLEL_MARK
- required_markers_cnt = markers < MAX_MARKERS ? markers : MAX_MARKERS;
-# endif
-}
-
GC_INNER void GC_thr_init(void)
{
struct GC_stack_base sb;