Merge pull request #5714 from alexischr/update_bockbuild
[mono.git] / libgc / solaris_pthreads.c
index bae77193593f5e963ccd7b1531f3bb774840a802..b1c70feebc594fbec0cb979f52ccf402e4d9f64d 100644 (file)
  * Modified by Peter C. for Solaris Posix Threads.
  */
 
-# if defined(GC_SOLARIS_PTHREADS)
 # include "private/gc_priv.h"
+
+# if defined(GC_SOLARIS_PTHREADS)
+
+/* Avoid  #error"Cannot use procfs in the large file compilation environment" */
+#if defined(_ILP32) && (_FILE_OFFSET_BITS != 32)
+#undef _FILE_OFFSET_BITS
+#define _FILE_OFFSET_BITS 32
+#endif
+
 # include <pthread.h>
 # include <thread.h>
 # include <signal.h>
@@ -63,6 +71,22 @@ int GC_pthread_join(pthread_t wait_for, void **status)
        return GC_thr_join((thread_t)wait_for, NULL, status);
 }
 
+int GC_pthread_detach(pthread_t thread)
+{
+       GC_thread t;
+
+       LOCK();
+       t=GC_lookup_thread(thread);     
+       UNLOCK();
+       if (t) {
+               LOCK();
+               t->flags |= DETACHED;
+               UNLOCK();
+               return 0;
+       }
+       else
+               return pthread_detach(thread);
+}
 
 int
 GC_pthread_create(pthread_t *new_thread,