Skip to content

Commit

Permalink
Fix detection of number of CPU cores on Cosmo
Browse files Browse the repository at this point in the history
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).
  • Loading branch information
ivmai committed Oct 17, 2024
1 parent 4254d96 commit 2fdc6d2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 2 additions & 0 deletions include/private/gcconfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions pthread_support.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down

0 comments on commit 2fdc6d2

Please sign in to comment.