Browse Source

Threads renamed from threads to systhrds

michael 23 years ago
parent
commit
55d5428013
1 changed files with 15 additions and 43 deletions
  1. 15 43
      rtl/unix/systhrds.pp

+ 15 - 43
rtl/unix/threads.pp → rtl/unix/systhrds.pp

@@ -14,7 +14,7 @@
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 
 
  **********************************************************************}
  **********************************************************************}
-unit threads;
+unit systhrds;
 interface
 interface
 
 
 {$S-}
 {$S-}
@@ -40,6 +40,13 @@ interface
 
 
 implementation
 implementation
 
 
+{*****************************************************************************
+                             Generic overloaded 
+*****************************************************************************}
+
+{ Include generic overloaded routines }
+{$i thread.inc}
+
 
 
 {*****************************************************************************
 {*****************************************************************************
                    Local POSIX Threads (pthread) imports
                    Local POSIX Threads (pthread) imports
@@ -297,7 +304,6 @@ end;
         inc(threadvarblocksize,size);
         inc(threadvarblocksize,size);
       end;
       end;
 
 
-
     function SysRelocateThreadvar(offset : dword) : pointer;
     function SysRelocateThreadvar(offset : dword) : pointer;
       begin
       begin
         SysRelocateThreadvar:=pthread_getspecific(tlskey)+Offset;
         SysRelocateThreadvar:=pthread_getspecific(tlskey)+Offset;
@@ -327,19 +333,6 @@ end;
 { Include OS independent Threadvar initialization }
 { Include OS independent Threadvar initialization }
 {$i threadvar.inc}
 {$i threadvar.inc}
 
 
-    procedure InitThreadVars;
-      begin
-        { We're still running in single thread mode, setup the TLS }
-        pthread_key_create(@TLSKey,nil);
-        { initialize threadvars }
-        init_all_unit_threadvars;
-        { allocate mem for main thread threadvars }
-        SysAllocateThreadVars;
-        { copy main thread threadvars }
-        copy_all_unit_threadvars;
-        { install threadvar handler }
-        fpc_threadvar_relocate_proc:=@SysRelocateThreadvar;
-      end;
 
 
 {$endif HASTHREADVAR}
 {$endif HASTHREADVAR}
 
 
@@ -348,9 +341,6 @@ end;
                             Thread starting
                             Thread starting
 *****************************************************************************}
 *****************************************************************************}
 
 
-    const
-      DefaultStackSize = 32768; { including 16384 margin for stackchecking }
-
     type
     type
       pthreadinfo = ^tthreadinfo;
       pthreadinfo = ^tthreadinfo;
       tthreadinfo = record
       tthreadinfo = record
@@ -359,22 +349,6 @@ end;
         stklen : cardinal;
         stklen : cardinal;
       end;
       end;
 
 
-    procedure InitThread(stklen:cardinal);
-      begin
-        SysResetFPU;
-        { ExceptAddrStack and ExceptObjectStack are threadvars       }
-        { so every thread has its on exception handling capabilities }
-        SysInitExceptions;
-        { Open all stdio fds again }
-        SysInitStdio;
-        InOutRes:=0;
-        // ErrNo:=0;
-        { Stack checking }
-        StackLength:=stklen;
-        StackBottom:=Sptr - StackLength;
-      end;
-
-
     procedure DoneThread;
     procedure DoneThread;
       begin
       begin
         { Release Threadvars }
         { Release Threadvars }
@@ -423,7 +397,9 @@ end;
         if not IsMultiThread then
         if not IsMultiThread then
          begin
          begin
 {$ifdef HASTHREADVAR}
 {$ifdef HASTHREADVAR}
-           InitThreadVars;
+          { We're still running in single thread mode, setup the TLS }
+           pthread_key_create(@TLSKey,nil);
+           InitThreadVars(@SysRelocateThreadvar);
 {$endif HASTHREADVAR}
 {$endif HASTHREADVAR}
            IsMultiThread:=true;
            IsMultiThread:=true;
          end;
          end;
@@ -525,19 +501,15 @@ end;
       end;
       end;
 
 
 
 
-{*****************************************************************************
-                             Generic overloaded 
-*****************************************************************************}
-
-{ Include generic overloaded routines }
-{$i thread.inc}
-
 initialization
 initialization
   InitHeapMutexes;
   InitHeapMutexes;
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.1  2002-10-14 19:39:17  peter
+  Revision 1.1  2002-10-16 06:22:56  michael
+  Threads renamed from threads to systhrds
+
+  Revision 1.1  2002/10/14 19:39:17  peter
     * threads unit added for thread support
     * threads unit added for thread support
 
 
 }
 }