+2010-02-15 Ivan Maidanski <ivmai@mail.ru> (really Alexandr Shadchin)
+
+ * pthread_support.c: Include <sys/param.h> and <sys/sysctl.h> 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 <ivmai@mail.ru>
* mallocx.c (GC_generic_malloc_many, GC_malloc_many): Define even
# include <sys/sysctl.h>
#endif /* GC_DARWIN_THREADS */
-#if defined(GC_NETBSD_THREADS)
+#if defined(GC_NETBSD_THREADS) || defined(GC_OPENBSD_THREADS)
# include <sys/param.h>
# include <sys/sysctl.h>
#endif /* GC_NETBSD_THREADS */
}
#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};
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