From 2fdc6d272730119b669e43146c3ce2f59c801fb0 Mon Sep 17 00:00:00 2001 From: Ivan Maidanski Date: Thu, 17 Oct 2024 09:12:02 +0300 Subject: [PATCH] Fix detection of number of CPU cores on Cosmo Issue #666 (bdwgc). Prevously, GC_get_nprocs() always reported 1 core. * include/private/gcconfig.h [COSMO] (PARALLEL_MARK): Undefine; add FIXME item. * pthread_support.c [!HPUX && COSMO] (GC_get_nprocs): Use sysconf(_SC_NPROCESSORS_ONLN). --- include/private/gcconfig.h | 2 ++ pthread_support.c | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/include/private/gcconfig.h b/include/private/gcconfig.h index b21d0dc25..cb1640e7d 100644 --- a/include/private/gcconfig.h +++ b/include/private/gcconfig.h @@ -831,6 +831,8 @@ extern int _end[]; # define MPROTECT_VDB /* FIXME: otherwise gctest crashes in child */ # endif +# /* FIXME: a deadlock occurs in markers, thus disabled for now */ +# undef PARALLEL_MARK #endif /* COSMO */ #ifdef DARWIN diff --git a/pthread_support.c b/pthread_support.c index 74d392744..1c31320a8 100644 --- a/pthread_support.c +++ b/pthread_support.c @@ -1093,8 +1093,9 @@ GC_greatest_stack_base_below(ptr_t bound) # ifdef HPUX # define GC_get_nprocs() pthread_num_processors_np() -# elif defined(AIX) || defined(HAIKU) || defined(HOST_ANDROID) \ - || defined(HURD) || defined(NACL) || defined(OSF1) || defined(SOLARIS) +# elif defined(AIX) || defined(COSMO) || defined(HAIKU) \ + || defined(HOST_ANDROID) || defined(HURD) || defined(NACL) \ + || defined(OSF1) || defined(SOLARIS) GC_INLINE int GC_get_nprocs(void) {