فهرست منبع

+ More system-independent thread routines

michael 23 سال پیش
والد
کامیت
cb5a3c7050
3فایلهای تغییر یافته به همراه42 افزوده شده و 3 حذف شده
  1. 18 1
      rtl/inc/thread.inc
  2. 8 1
      rtl/inc/threadh.inc
  3. 16 1
      rtl/inc/threadvar.inc

+ 18 - 1
rtl/inc/thread.inc

@@ -18,6 +18,20 @@
                            Threadvar initialization
 *****************************************************************************}
 
+    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;
 
 {*****************************************************************************
                             Overloaded functions
@@ -67,7 +81,10 @@
 
 {
   $Log$
-  Revision 1.1  2002-10-14 19:39:17  peter
+  Revision 1.2  2002-10-16 19:04:27  michael
+  + More system-independent thread routines
+
+  Revision 1.1  2002/10/14 19:39:17  peter
     * threads unit added for thread support
 
 }

+ 8 - 1
rtl/inc/threadh.inc

@@ -14,6 +14,10 @@
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 
  **********************************************************************}
+ 
+const
+   DefaultStackSize = 32768; { including 16384 margin for stackchecking }
+
 
 type
    TThreadFunc = function(parameter : pointer) : longint;
@@ -50,7 +54,10 @@ procedure LeaveCriticalsection(var cs : TRTLCriticalSection);
 
 {
   $Log$
-  Revision 1.8  2002-10-14 19:39:17  peter
+  Revision 1.9  2002-10-16 19:04:27  michael
+  + More system-independent thread routines
+
+  Revision 1.8  2002/10/14 19:39:17  peter
     * threads unit added for thread support
 
   Revision 1.7  2002/09/07 15:07:46  peter

+ 16 - 1
rtl/inc/threadvar.inc

@@ -85,11 +85,26 @@ begin
     copy_unit_threadvars (ThreadvarTablesTable.tables[i]);
 end;
 
+    procedure InitThreadVars(RelocProc : Pointer);
+      begin
+        { 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:=RelocProc;
+      end;
+
 {$endif HASTHREADVAR}
 
 {
   $Log$
-  Revision 1.1  2002-10-14 19:39:17  peter
+  Revision 1.2  2002-10-16 19:04:27  michael
+  + More system-independent thread routines
+
+  Revision 1.1  2002/10/14 19:39:17  peter
     * threads unit added for thread support
 
 }