From: ivmai Date: Mon, 15 Feb 2010 09:10:29 +0000 (+0000) Subject: 2010-02-15 Ivan Maidanski (really Alexandr Shadchin) X-Git-Tag: gc7_2alpha5-20110107~71 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=baa8ac641853f032e6c6e3788e6cbe569a24f946;p=gc 2010-02-15 Ivan Maidanski (really Alexandr Shadchin) * pthread_support.c: Include and for OpenBSD. * pthread_support.c (get_ncpu): Define also for Darwin, NetBSD and OpenBSD. * pthread_support.c (GC_thr_init): Use get_ncpu() for Darwin, NetBSD and OpenBSD. --- diff --git a/ChangeLog b/ChangeLog index 42804e48..a3a787df 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2010-02-15 Ivan Maidanski (really Alexandr Shadchin) + + * pthread_support.c: Include and for + OpenBSD. + * pthread_support.c (get_ncpu): Define also for Darwin, NetBSD and + OpenBSD. + * pthread_support.c (GC_thr_init): Use get_ncpu() for Darwin, + NetBSD and OpenBSD. + 2010-02-04 Ivan Maidanski * mallocx.c (GC_generic_malloc_many, GC_malloc_many): Define even diff --git a/pthread_support.c b/pthread_support.c index fc767146..b9e05f39 100644 --- a/pthread_support.c +++ b/pthread_support.c @@ -71,7 +71,7 @@ # include #endif /* GC_DARWIN_THREADS */ -#if defined(GC_NETBSD_THREADS) +#if defined(GC_NETBSD_THREADS) || defined(GC_OPENBSD_THREADS) # include # include #endif /* GC_NETBSD_THREADS */ @@ -755,7 +755,8 @@ STATIC void GC_fork_child_proc(void) } #endif /* GC_DGUX386_THREADS */ -#if defined(GC_NETBSD_THREADS) +#if defined(GC_DARWIN_THREADS) || defined(GC_FREEBSD_THREADS) \ + || defined(GC_NETBSD_THREADS) || defined(GC_OPENBSD_THREADS) static int get_ncpu(void) { int mib[] = {CTL_HW,HW_NCPU}; @@ -832,19 +833,10 @@ GC_INNER void GC_thr_init(void) GC_nprocs = sysconf(_SC_NPROC_ONLN); if (GC_nprocs <= 0) GC_nprocs = 1; # endif -# if defined(GC_NETBSD_THREADS) +# if defined(GC_DARWIN_THREADS) || defined(GC_FREEBSD_THREADS) \ + || defined(GC_NETBSD_THREADS) || defined(GC_OPENBSD_THREADS) GC_nprocs = get_ncpu(); # endif -# if defined(GC_OPENBSD_THREADS) - /* FIXME: Implement real "get_ncpu". */ - GC_nprocs = 2; -# endif -# if defined(GC_DARWIN_THREADS) || defined(GC_FREEBSD_THREADS) - int ncpus = 1; - size_t len = sizeof(ncpus); - sysctl((int[2]) {CTL_HW, HW_NCPU}, 2, &ncpus, &len, NULL, 0); - GC_nprocs = ncpus; -# endif # if defined(GC_LINUX_THREADS) || defined(GC_DGUX386_THREADS) GC_nprocs = GC_get_nprocs(); # endif