summaryrefslogtreecommitdiff
path: root/lang/mono/patches/patch-ak
diff options
context:
space:
mode:
Diffstat (limited to 'lang/mono/patches/patch-ak')
-rw-r--r--lang/mono/patches/patch-ak80
1 files changed, 80 insertions, 0 deletions
diff --git a/lang/mono/patches/patch-ak b/lang/mono/patches/patch-ak
new file mode 100644
index 00000000000..3013ed1964f
--- /dev/null
+++ b/lang/mono/patches/patch-ak
@@ -0,0 +1,80 @@
+$NetBSD: patch-ak,v 1.6 2005/07/31 15:26:58 recht Exp $
+
+--- libgc/pthread_support.c.orig 2005-06-19 11:59:53.000000000 +0200
++++ libgc/pthread_support.c
+@@ -68,7 +68,7 @@
+ # endif
+
+ # if (defined(GC_DGUX386_THREADS) || defined(GC_OSF1_THREADS) || \
+- defined(GC_DARWIN_THREADS)) && !defined(USE_PTHREAD_SPECIFIC)
++ defined(GC_DARWIN_THREADS) || defined(GC_NETBSD_THREADS)) && !defined(USE_PTHREAD_SPECIFIC)
+ # define USE_PTHREAD_SPECIFIC
+ # endif
+
+@@ -120,7 +120,10 @@
+ # include <sys/sysctl.h>
+ #endif /* GC_DARWIN_THREADS */
+
+-
++#if defined(GC_NETBSD_THREADS)
++# include <sys/param.h>
++# include <sys/sysctl.h>
++#endif
+
+ #if defined(GC_DGUX386_THREADS)
+ # include <sys/dg_sys_info.h>
+@@ -956,7 +959,7 @@ void GC_thr_init()
+ # if defined(GC_FREEBSD_THREADS)
+ GC_nprocs = 1;
+ # endif
+-# if defined(GC_DARWIN_THREADS)
++# if defined(GC_DARWIN_THREADS) || defined(GC_NETBSD_THREADS)
+ int ncpus = 1;
+ size_t len = sizeof(ncpus);
+ sysctl((int[2]) {CTL_HW, HW_NCPU}, 2, &ncpus, &len, NULL, 0);
+@@ -1093,8 +1096,24 @@ void GC_end_blocking(void) {
+ #define __d10_sleep sleep
+ #endif /* GC_DGUX386_THREADS */
+
++#undef nanosleep
++#undef usleep
++#undef sleep
++
++/* A wrapper for the standard C nanosleep function */
++int WRAP_FUNC(nanosleep) (const struct timespec *rqtp, struct timespec *rmtp)
++{
++ int result;
++
++ GC_start_blocking();
++ result = REAL_FUNC(nanosleep)(rqtp, rmtp);
++ GC_end_blocking();
++
++ return result;
++}
++
+ /* A wrapper for the standard C sleep function */
+-int WRAP_FUNC(sleep) (unsigned int seconds)
++unsigned int WRAP_FUNC(sleep) (unsigned int seconds)
+ {
+ int result;
+
+@@ -1104,6 +1123,19 @@ int WRAP_FUNC(sleep) (unsigned int secon
+ return result;
+ }
+
++/* A wrapper for the standard C usleep function */
++int WRAP_FUNC(usleep) (useconds_t microseconds)
++{
++ int result;
++
++ GC_start_blocking();
++ result = REAL_FUNC(usleep)(microseconds);
++ GC_end_blocking();
++
++ return result;
++}
++
++
+ struct start_info {
+ void *(*start_routine)(void *);
+ void *arg;