* src/mm/gc-boehm.cpp: Define GC_SOLARIS_THREADS on Solaris.
[cacao.git] / src / threads / posix / thread-posix.cpp
index 6a0e54adce134c6c7828b12e4a4797b93288f34e..a68cede39cf91c405bd86f2180fd3f137c519e65 100644 (file)
@@ -1,6 +1,6 @@
 /* src/threads/posix/thread-posix.cpp - POSIX thread functions
 
-   Copyright (C) 1996-2005, 2006, 2007, 2008
+   Copyright (C) 1996-2005, 2006, 2007, 2008, 2010
    CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO
 
    This file is part of CACAO.
 
 #include "vm/jit/asmpart.h"
 
-#if !defined(__DARWIN__)
+#if defined(__DARWIN__)
+
+typedef struct {
+       Mutex* mutex;
+       Condition* cond;
+       int value;
+} sem_t;
+
+#else
 # include <semaphore.h>
 #endif
 
@@ -90,6 +98,8 @@
 # define GC_IRIX_THREADS
 #elif defined(__DARWIN__)
 # define GC_DARWIN_THREADS
+#elif defined(__SOLARIS__)
+# define GC_SOLARIS_THREADS
 #endif
 
 #if defined(ENABLE_GC_BOEHM)
@@ -575,8 +585,6 @@ void threads_impl_thread_free(threadobject *t)
 
 void threads_impl_preinit(void)
 {
-       int result;
-
        stopworldlock = new Mutex();
 
        /* initialize exit mutex and condition (on exit we join all
@@ -593,7 +601,7 @@ void threads_impl_preinit(void)
 #endif
 
 #if !defined(HAVE___THREAD)
-       result = pthread_key_create(&thread_current_key, NULL);
+       int result = pthread_key_create(&thread_current_key, NULL);
        if (result != 0)
                os::abort_errnum(result, "threads_impl_preinit: pthread_key_create failed");
 #endif