Browse Source

+ Renamed thread unit to systhrds

michael 23 years ago
parent
commit
39f16b03ef
4 changed files with 27 additions and 49 deletions
  1. 5 2
      compiler/pmodules.pas
  2. 4 3
      rtl/win32/Makefile
  3. 3 1
      rtl/win32/Makefile.fpc
  4. 15 43
      rtl/win32/systhrds.pp

+ 5 - 2
compiler/pmodules.pas

@@ -436,7 +436,7 @@ implementation
       { Thread support unit? }
         if (cs_threading in aktmoduleswitches) then
          begin
-           hp:=loadunit('Threads','');
+           hp:=loadunit('systhrds','');
            tsymtable(hp.globalsymtable).next:=symtablestack;
            symtablestack:=hp.globalsymtable;
            { add to the used units }
@@ -1433,7 +1433,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.81  2002-10-14 19:42:34  peter
+  Revision 1.82  2002-10-16 06:32:52  michael
+  + Renamed thread unit to systhrds
+
+  Revision 1.81  2002/10/14 19:42:34  peter
     * only use init tables for threadvars
 
   Revision 1.80  2002/10/06 19:41:30  peter

+ 4 - 3
rtl/win32/Makefile

@@ -1,8 +1,8 @@
 #
-# Don't edit, this file is generated by FPCMake Version 1.1 [2002/10/07]
+# Don't edit, this file is generated by FPCMake Version 1.1 [2002/10/05]
 #
 default: all
-MAKEFILETARGETS=linux go32v2 win32 os2 freebsd beos netbsd amiga atari sunos qnx netware openbsd wdosx
+MAKEFILETARGETS=win32
 override PATH:=$(subst \,/,$(PATH))
 ifeq ($(findstring ;,$(PATH)),)
 inUnix=1
@@ -234,7 +234,7 @@ OBJPASDIR=$(RTL)/objpas
 GRAPHDIR=$(INC)/graph
 include $(WININC)/makefile.inc
 WINDOWS_SOURCE_FILES=$(addprefix $(WININC)/,$(addsuffix .inc,$(WINDOWS_FILES)))
-override TARGET_UNITS+=$(SYSTEMUNIT) threads objpas strings lineinfo heaptrc windows ole2 activex opengl32 winsock initc dos crt objects graph messages sysutils typinfo math varutils variants cpu mmx charset ucomplex getopts wincrt winmouse winevent sockets printer dynlibs video mouse keyboard types comobj
+override TARGET_UNITS+=$(SYSTEMUNIT) systhrds objpas strings lineinfo heaptrc windows ole2 activex opengl32 winsock initc dos crt objects graph messages sysutils typinfo math varutils variants cpu mmx charset ucomplex getopts wincrt winmouse winevent sockets printer dynlibs video mouse keyboard types comobj
 override TARGET_LOADERS+=wprt0 wdllprt0
 override TARGET_RSTS+=math varutils typinfo
 override INSTALL_FPCPACKAGE=y
@@ -1208,6 +1208,7 @@ wdllprt0$(OEXT) : wdllprt0.as
 	$(AS) -o wdllprt0$(OEXT) wdllprt0.as
 $(SYSTEMUNIT)$(PPUEXT) : $(SYSTEMUNIT).pp win32.inc $(SYSDEPS)
 	$(COMPILER) -Us -Sg $(SYSTEMUNIT).pp
+systhrds$(PPUEXT): systhrds.pp $(INC)/threadh.inc $(SYSTEMUNIT)$(PPUEXT)
 objpas$(PPUEXT): $(OBJPASDIR)/objpas.pp $(INC)/except.inc $(SYSTEMUNIT)$(PPUEXT)
 	$(COMPILER) -I$(OBJPASDIR) $(OBJPASDIR)/objpas.pp
 strings$(PPUEXT) : $(INC)/strings.pp $(INC)/stringsi.inc\

+ 3 - 1
rtl/win32/Makefile.fpc

@@ -7,7 +7,7 @@ main=rtl
 
 [target]
 loaders=wprt0 wdllprt0
-units=$(SYSTEMUNIT) threads objpas strings \
+units=$(SYSTEMUNIT) systhrds objpas strings \
       lineinfo heaptrc \
       windows ole2 activex opengl32 winsock initc \
       dos crt objects graph messages \
@@ -104,6 +104,8 @@ wdllprt0$(OEXT) : wdllprt0.as
 $(SYSTEMUNIT)$(PPUEXT) : $(SYSTEMUNIT).pp win32.inc $(SYSDEPS)
         $(COMPILER) -Us -Sg $(SYSTEMUNIT).pp
 
+systhrds$(PPUEXT): systhrds.pp $(INC)/threadh.inc $(SYSTEMUNIT)$(PPUEXT)
+
 objpas$(PPUEXT): $(OBJPASDIR)/objpas.pp $(INC)/except.inc $(SYSTEMUNIT)$(PPUEXT)
         $(COMPILER) -I$(OBJPASDIR) $(OBJPASDIR)/objpas.pp
 

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

@@ -14,7 +14,7 @@
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 
  **********************************************************************}
-unit threads;
+unit systhrds;
 interface
 
 {$S-}
@@ -39,6 +39,13 @@ interface
 
 implementation
 
+{*****************************************************************************
+                             Generic overloaded
+*****************************************************************************}
+
+{ Include generic overloaded routines }
+{$i thread.inc}
+
 
 {*****************************************************************************
                            Local WINApi imports
@@ -113,20 +120,6 @@ function GlobalFree(hMem : Pointer):Pointer; external 'kernel32' name 'GlobalFre
 { Include OS independent Threadvar initialization }
 {$i threadvar.inc}
 
-    procedure InitThreadVars;
-      begin
-        { We're still running in single thread mode, setup the TLS }
-        TLSKey:=TlsAlloc;
-        { 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}
 
 
@@ -134,9 +127,6 @@ function GlobalFree(hMem : Pointer):Pointer; external 'kernel32' name 'GlobalFre
                             Thread starting
 *****************************************************************************}
 
-    const
-      DefaultStackSize = 32768; { including 16384 margin for stackchecking }
-
     type
       pthreadinfo = ^tthreadinfo;
       tthreadinfo = record
@@ -145,22 +135,6 @@ function GlobalFree(hMem : Pointer):Pointer; external 'kernel32' name 'GlobalFre
         stklen : cardinal;
       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;
       begin
         { Release Threadvars }
@@ -208,7 +182,9 @@ function GlobalFree(hMem : Pointer):Pointer; external 'kernel32' name 'GlobalFre
         if not IsMultiThread then
          begin
 {$ifdef HASTHREADVAR}
-           InitThreadVars;
+           { We're still running in single thread mode, setup the TLS }
+           TLSKey:=TlsAlloc;
+           InitThreadVars(@SysRelocateThreadvar);
 {$endif HASTHREADVAR}
            IsMultiThread:=true;
          end;
@@ -294,19 +270,15 @@ procedure LeaveCriticalSection(var cs : TRTLCriticalSection);
       end;
 
 
-{*****************************************************************************
-                             Generic overloaded
-*****************************************************************************}
-
-{ Include generic overloaded routines }
-{$i thread.inc}
-
 initialization
   InitHeapMutexes;
 end.
 {
   $Log$
-  Revision 1.1  2002-10-14 19:39:18  peter
+  Revision 1.1  2002-10-16 06:27:30  michael
+  + Renamed thread unit to systhrds
+
+  Revision 1.1  2002/10/14 19:39:18  peter
     * threads unit added for thread support
 
 }