changeset 558:02fb65cddc3e

Merge rest of patch from #72.
author Christian Kamm <kamm incasoftware de>
date Fri, 29 Aug 2008 14:48:40 +0200
parents aef77ae1d32c
children 5d6ef6e6805d
files runtime/internal/critical.c runtime/internal/memory.d runtime/internal/monitor.c
diffstat 3 files changed, 21 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/runtime/internal/critical.c	Fri Aug 29 14:16:18 2008 +0200
+++ b/runtime/internal/critical.c	Fri Aug 29 14:48:40 2008 +0200
@@ -75,12 +75,16 @@
 
 /* ================================= linux ============================ */
 
-#if linux
+#if linux || __APPLE__
 
 #include	<stdio.h>
 #include	<stdlib.h>
 #include	<pthread.h>
 
+#ifndef HAVE_PTHREAD_MUTEX_RECURSIVE
+#define PTHREAD_MUTEX_RECURSIVE_NP PTHREAD_MUTEX_RECURSIVE
+#endif
+
 /******************************************
  * Enter/exit critical section.
  */
--- a/runtime/internal/memory.d	Fri Aug 29 14:16:18 2008 +0200
+++ b/runtime/internal/memory.d	Fri Aug 29 14:48:40 2008 +0200
@@ -85,6 +85,10 @@
                 return *libc_stack_end;
         }
     }
+    else version( darwin )
+    {
+        static assert( false, "darwin not supported" );
+    }
     else
     {
         static assert( false, "Operating system not supported." );
@@ -147,6 +151,10 @@
             alias __data_start  Data_Start;
             alias _end          Data_End;
     }
+    else version( darwin )
+    {
+        // TODO: How to access the darwin data segment?
+    }
 
     alias void delegate( void*, void* ) scanFn;
 }
@@ -166,6 +174,10 @@
         //printf("scanning static data from %p to %p\n", &Data_Start, &Data_End);
         scan( &Data_Start, &Data_End );
     }
+    else version( darwin )
+    {
+        static assert( false, "darwin not supported." );
+    }
     else
     {
         static assert( false, "Operating system not supported." );
--- a/runtime/internal/monitor.c	Fri Aug 29 14:16:18 2008 +0200
+++ b/runtime/internal/monitor.c	Fri Aug 29 14:48:40 2008 +0200
@@ -127,6 +127,10 @@
 
 #if USE_PTHREADS
 
+#ifndef HAVE_PTHREAD_MUTEX_RECURSIVE
+#define PTHREAD_MUTEX_RECURSIVE_NP PTHREAD_MUTEX_RECURSIVE
+#endif
+
 // Includes attribute fixes from David Friedman's GDC port
 
 static pthread_mutex_t _monitor_critsec;