]> git.llucax.com Git - software/druntime.git/blobdiff - src/common/core/thread.d
Removed stdc directory. This was moved to core/stdc.
[software/druntime.git] / src / common / core / thread.d
index 7c27bf2004019af3f3aed6f096f18f3797eb5c77..ef8984b63b9a4dcba6c72b9394e04e79ee4997a4 100644 (file)
@@ -84,8 +84,8 @@ version( Windows )
 {
     private
     {
 {
     private
     {
-        import stdc.stdint : uintptr_t; // for _beginthreadex decl below
-        import sys.windows.windows;
+        import core.stdc.stdint : uintptr_t; // for _beginthreadex decl below
+        import core.sys.windows.windows;
 
         const DWORD TLS_OUT_OF_INDEXES  = 0xFFFFFFFF;
 
 
         const DWORD TLS_OUT_OF_INDEXES  = 0xFFFFFFFF;
 
@@ -151,13 +151,14 @@ else version( Posix )
 {
     private
     {
 {
     private
     {
-        import stdc.posix.semaphore;
-        import stdc.posix.pthread;
-        import stdc.posix.signal;
-        import stdc.posix.time;
-        import stdc.errno;
+        import core.sys.posix.semaphore;
+        import core.sys.posix.pthread;
+        import core.sys.posix.signal;
+        import core.sys.posix.time;
+        import core.stdc.errno;
 
         extern (C) int getErrno();
 
         extern (C) int getErrno();
+
         version( GNU )
         {
             import gcc.builtins;
         version( GNU )
         {
             import gcc.builtins;
@@ -199,8 +200,20 @@ else version( Posix )
             //       implementation actually requires default initialization
             //       then pthread_cleanup should be restructured to maintain
             //       the current lack of a link dependency.
             //       implementation actually requires default initialization
             //       then pthread_cleanup should be restructured to maintain
             //       the current lack of a link dependency.
+            version( linux )
+            {
+                pthread_cleanup cleanup = void;
+                cleanup.push( &thread_cleanupHandler, cast(void*) obj );
+            }
+            else version( darwin )
+            {
             pthread_cleanup cleanup = void;
             cleanup.push( &thread_cleanupHandler, cast(void*) obj );
             pthread_cleanup cleanup = void;
             cleanup.push( &thread_cleanupHandler, cast(void*) obj );
+            }
+            else
+            {
+                pthread_cleanup_push( &thread_cleanupHandler, cast(void*) obj );
+            }
 
             // NOTE: For some reason this does not always work for threads.
             //obj.m_main.bstack = getStackBottom();
 
             // NOTE: For some reason this does not always work for threads.
             //obj.m_main.bstack = getStackBottom();
@@ -2244,9 +2257,9 @@ private
 
     version( Posix )
     {
 
     version( Posix )
     {
-        import stdc.posix.unistd;   // for sysconf
-        import stdc.posix.sys.mman; // for mmap
-        import stdc.posix.stdlib;   // for malloc, valloc, free
+        import core.sys.posix.unistd;   // for sysconf
+        import core.sys.posix.sys.mman; // for mmap
+        import core.sys.posix.stdlib;   // for malloc, valloc, free
 
         version( AsmX86_Win32 ) {} else
         version( AsmX86_Posix ) {} else
 
         version( AsmX86_Win32 ) {} else
         version( AsmX86_Posix ) {} else
@@ -2258,7 +2271,7 @@ private
             //       a version identifier.  Please note that this is considered
             //       an obsolescent feature according to the POSIX spec, so a
             //       custom solution is still preferred.
             //       a version identifier.  Please note that this is considered
             //       an obsolescent feature according to the POSIX spec, so a
             //       custom solution is still preferred.
-            import stdc.posix.ucontext;
+            import core.sys.posix.ucontext;
         }
     }
 
         }
     }