浏览代码

AROS: in agreement with Marcus Sackrow, AThreads is now enabled for AROS, and the old AROS-specific threading implementation is zapped

git-svn-id: trunk@31008 -
Károly Balogh 10 年之前
父节点
当前提交
1a53f6a799

+ 0 - 4
.gitattributes

@@ -8096,7 +8096,6 @@ rtl/arm/thumb.inc svneol=native#text/plain
 rtl/arm/thumb2.inc svneol=native#text/plain
 rtl/aros/Makefile svneol=native#text/plain
 rtl/aros/Makefile.fpc svneol=native#text/plain
-rtl/aros/arosthreads.inc svneol=native#text/plain
 rtl/aros/doslibd.inc svneol=native#text/plain
 rtl/aros/i386/doslibf.inc svneol=native#text/plain
 rtl/aros/i386/execd.inc svneol=native#text/plain
@@ -8106,10 +8105,7 @@ rtl/aros/i386/utild1.inc svneol=native#text/plain
 rtl/aros/i386/utild2.inc svneol=native#text/plain
 rtl/aros/i386/utilf.inc svneol=native#text/plain
 rtl/aros/system.pp svneol=native#text/plain
-rtl/aros/systemthreadh.inc svneol=native#text/plain
-rtl/aros/systhrd.inc svneol=native#text/plain
 rtl/aros/timerd.inc svneol=native#text/plain
-rtl/aros/tthread.inc svneol=native#text/plain
 rtl/atari/Makefile svneol=native#text/plain
 rtl/atari/Makefile.fpc svneol=native#text/plain
 rtl/atari/prt0.as svneol=native#text/plain

+ 2 - 5
rtl/amicommon/sysosh.inc

@@ -25,15 +25,12 @@ type
   TThreadID = THandle;
 
   PRTLCriticalSection = ^TRTLCriticalSection;
-{$IFDEF AROS}
-  TRTLCriticalSection = Pointer;
-{$ELSE}
   TRTLCriticalSection = record
     { This must actually be bigger or equal to sizeof(TSignalSemaphore)
-      which seems to be 46 bytes on MorphOS and Amiga/m68k. }
+      which seems to be 46 bytes on MorphOS and Amiga/m68k and
+      56 bytes on AROS/x86 ABIv0. }
     semaphore: array[0..63] of byte;
   end;
-{$ENDIF}
 
 { BeginThread flags we support in AThreads }
 const

+ 83 - 81
rtl/aros/Makefile

@@ -1,5 +1,5 @@
 #
-# Don't edit, this file is generated by FPCMake Version 2.0.0 [2015-05-20 rev 30890]
+# Don't edit, this file is generated by FPCMake Version 2.0.0 [2015/06/07]
 #
 default: all
 MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-haiku i386-netbsd i386-solaris i386-qnx i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince i386-embedded i386-symbian i386-nativent i386-iphonesim i386-android i386-aros m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos m68k-embedded powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macos powerpc-darwin powerpc-morphos powerpc-embedded powerpc-wii powerpc-aix sparc-linux sparc-netbsd sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-netbsd x86_64-solaris x86_64-openbsd x86_64-darwin x86_64-win64 x86_64-embedded x86_64-iphonesim x86_64-dragonfly arm-linux arm-palmos arm-darwin arm-wince arm-gba arm-nds arm-embedded arm-symbian arm-android powerpc64-linux powerpc64-darwin powerpc64-embedded powerpc64-aix avr-embedded armeb-linux armeb-embedded mips-linux mipsel-linux mipsel-embedded mipsel-android jvm-java jvm-android i8086-msdos aarch64-linux aarch64-darwin
@@ -341,244 +341,244 @@ override FPCOPT+=-Ur
 endif
 OBJPASDIR=$(RTL)/objpas
 ifeq ($(FULL_TARGET),i386-linux)
-override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character
+override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character athreads
 endif
 ifeq ($(FULL_TARGET),i386-go32v2)
-override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character
+override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character athreads
 endif
 ifeq ($(FULL_TARGET),i386-win32)
-override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character
+override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character athreads
 endif
 ifeq ($(FULL_TARGET),i386-os2)
-override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character
+override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character athreads
 endif
 ifeq ($(FULL_TARGET),i386-freebsd)
-override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character
+override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character athreads
 endif
 ifeq ($(FULL_TARGET),i386-beos)
-override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character
+override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character athreads
 endif
 ifeq ($(FULL_TARGET),i386-haiku)
-override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character
+override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character athreads
 endif
 ifeq ($(FULL_TARGET),i386-netbsd)
-override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character
+override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character athreads
 endif
 ifeq ($(FULL_TARGET),i386-solaris)
-override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character
+override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character athreads
 endif
 ifeq ($(FULL_TARGET),i386-qnx)
-override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character
+override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character athreads
 endif
 ifeq ($(FULL_TARGET),i386-netware)
-override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character
+override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character athreads
 endif
 ifeq ($(FULL_TARGET),i386-openbsd)
-override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character
+override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character athreads
 endif
 ifeq ($(FULL_TARGET),i386-wdosx)
-override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character
+override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character athreads
 endif
 ifeq ($(FULL_TARGET),i386-darwin)
-override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character
+override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character athreads
 endif
 ifeq ($(FULL_TARGET),i386-emx)
-override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character
+override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character athreads
 endif
 ifeq ($(FULL_TARGET),i386-watcom)
-override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character
+override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character athreads
 endif
 ifeq ($(FULL_TARGET),i386-netwlibc)
-override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character
+override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character athreads
 endif
 ifeq ($(FULL_TARGET),i386-wince)
-override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character
+override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character athreads
 endif
 ifeq ($(FULL_TARGET),i386-embedded)
-override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character
+override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character athreads
 endif
 ifeq ($(FULL_TARGET),i386-symbian)
-override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character
+override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character athreads
 endif
 ifeq ($(FULL_TARGET),i386-nativent)
-override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character
+override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character athreads
 endif
 ifeq ($(FULL_TARGET),i386-iphonesim)
-override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character
+override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character athreads
 endif
 ifeq ($(FULL_TARGET),i386-android)
-override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character
+override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character athreads
 endif
 ifeq ($(FULL_TARGET),i386-aros)
-override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character
+override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character athreads
 endif
 ifeq ($(FULL_TARGET),m68k-linux)
-override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character
+override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character athreads
 endif
 ifeq ($(FULL_TARGET),m68k-freebsd)
-override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character
+override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character athreads
 endif
 ifeq ($(FULL_TARGET),m68k-netbsd)
-override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character
+override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character athreads
 endif
 ifeq ($(FULL_TARGET),m68k-amiga)
-override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character
+override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character athreads
 endif
 ifeq ($(FULL_TARGET),m68k-atari)
-override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character
+override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character athreads
 endif
 ifeq ($(FULL_TARGET),m68k-openbsd)
-override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character
+override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character athreads
 endif
 ifeq ($(FULL_TARGET),m68k-palmos)
-override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character
+override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character athreads
 endif
 ifeq ($(FULL_TARGET),m68k-embedded)
-override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character
+override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character athreads
 endif
 ifeq ($(FULL_TARGET),powerpc-linux)
-override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character
+override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character athreads
 endif
 ifeq ($(FULL_TARGET),powerpc-netbsd)
-override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character
+override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character athreads
 endif
 ifeq ($(FULL_TARGET),powerpc-amiga)
-override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character
+override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character athreads
 endif
 ifeq ($(FULL_TARGET),powerpc-macos)
-override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character
+override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character athreads
 endif
 ifeq ($(FULL_TARGET),powerpc-darwin)
-override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character
+override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character athreads
 endif
 ifeq ($(FULL_TARGET),powerpc-morphos)
-override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character
+override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character athreads
 endif
 ifeq ($(FULL_TARGET),powerpc-embedded)
-override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character
+override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character athreads
 endif
 ifeq ($(FULL_TARGET),powerpc-wii)
-override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character
+override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character athreads
 endif
 ifeq ($(FULL_TARGET),powerpc-aix)
-override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character
+override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character athreads
 endif
 ifeq ($(FULL_TARGET),sparc-linux)
-override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character
+override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character athreads
 endif
 ifeq ($(FULL_TARGET),sparc-netbsd)
-override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character
+override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character athreads
 endif
 ifeq ($(FULL_TARGET),sparc-solaris)
-override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character
+override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character athreads
 endif
 ifeq ($(FULL_TARGET),sparc-embedded)
-override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character
+override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character athreads
 endif
 ifeq ($(FULL_TARGET),x86_64-linux)
-override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character
+override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character athreads
 endif
 ifeq ($(FULL_TARGET),x86_64-freebsd)
-override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character
+override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character athreads
 endif
 ifeq ($(FULL_TARGET),x86_64-netbsd)
-override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character
+override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character athreads
 endif
 ifeq ($(FULL_TARGET),x86_64-solaris)
-override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character
+override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character athreads
 endif
 ifeq ($(FULL_TARGET),x86_64-openbsd)
-override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character
+override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character athreads
 endif
 ifeq ($(FULL_TARGET),x86_64-darwin)
-override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character
+override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character athreads
 endif
 ifeq ($(FULL_TARGET),x86_64-win64)
-override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character
+override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character athreads
 endif
 ifeq ($(FULL_TARGET),x86_64-embedded)
-override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character
+override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character athreads
 endif
 ifeq ($(FULL_TARGET),x86_64-iphonesim)
-override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character
+override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character athreads
 endif
 ifeq ($(FULL_TARGET),x86_64-dragonfly)
-override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character
+override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character athreads
 endif
 ifeq ($(FULL_TARGET),arm-linux)
-override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character
+override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character athreads
 endif
 ifeq ($(FULL_TARGET),arm-palmos)
-override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character
+override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character athreads
 endif
 ifeq ($(FULL_TARGET),arm-darwin)
-override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character
+override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character athreads
 endif
 ifeq ($(FULL_TARGET),arm-wince)
-override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character
+override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character athreads
 endif
 ifeq ($(FULL_TARGET),arm-gba)
-override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character
+override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character athreads
 endif
 ifeq ($(FULL_TARGET),arm-nds)
-override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character
+override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character athreads
 endif
 ifeq ($(FULL_TARGET),arm-embedded)
-override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character
+override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character athreads
 endif
 ifeq ($(FULL_TARGET),arm-symbian)
-override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character
+override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character athreads
 endif
 ifeq ($(FULL_TARGET),arm-android)
-override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character
+override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character athreads
 endif
 ifeq ($(FULL_TARGET),powerpc64-linux)
-override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character
+override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character athreads
 endif
 ifeq ($(FULL_TARGET),powerpc64-darwin)
-override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character
+override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character athreads
 endif
 ifeq ($(FULL_TARGET),powerpc64-embedded)
-override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character
+override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character athreads
 endif
 ifeq ($(FULL_TARGET),powerpc64-aix)
-override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character
+override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character athreads
 endif
 ifeq ($(FULL_TARGET),avr-embedded)
-override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character
+override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character athreads
 endif
 ifeq ($(FULL_TARGET),armeb-linux)
-override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character
+override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character athreads
 endif
 ifeq ($(FULL_TARGET),armeb-embedded)
-override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character
+override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character athreads
 endif
 ifeq ($(FULL_TARGET),mips-linux)
-override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character
+override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character athreads
 endif
 ifeq ($(FULL_TARGET),mipsel-linux)
-override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character
+override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character athreads
 endif
 ifeq ($(FULL_TARGET),mipsel-embedded)
-override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character
+override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character athreads
 endif
 ifeq ($(FULL_TARGET),mipsel-android)
-override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character
+override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character athreads
 endif
 ifeq ($(FULL_TARGET),jvm-java)
-override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character
+override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character athreads
 endif
 ifeq ($(FULL_TARGET),jvm-android)
-override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character
+override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character athreads
 endif
 ifeq ($(FULL_TARGET),i8086-msdos)
-override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character
+override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character athreads
 endif
 ifeq ($(FULL_TARGET),aarch64-linux)
-override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character
+override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character athreads
 endif
 ifeq ($(FULL_TARGET),aarch64-darwin)
-override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character
+override TARGET_UNITS+=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings fpintres dos heaptrc lineinfo ctypes sysutils fgl classes math typinfo charset cpall getopts types rtlconsts sysconst character athreads
 endif
 ifeq ($(FULL_TARGET),i386-linux)
 override TARGET_IMPLICITUNITS+=exeinfo cp1250 cp1251 cp1252 cp1253 cp1254 cp1255 cp1256 cp1257 cp1258 cp437 cp646 cp850 cp856 cp866 cp874 cp8859_1 cp8859_5 cp8859_2 cp852 unicodedata unicodenumtable
@@ -3034,3 +3034,5 @@ cpall$(PPUEXT): $(RTL)/charmaps/cpall.pas system$(PPUEXT) charset$(PPUEXT)
 	$(COMPILER) -Fu$(INC) -Fi$(RTL)/charmaps $(RTL)/charmaps/cpall.pas
 fpintres$(PPUEXT) : $(INC)/fpintres.pp $(SYSTEMUNIT)$(PPUEXT)
 	$(COMPILER) $(INC)/fpintres.pp
+athreads$(PPUEXT) : athreads.pp $(SYSTEMUNIT)$(PPUEXT)
+	$(COMPILER) $(AMIINC)/athreads.pp

+ 5 - 1
rtl/aros/Makefile.fpc

@@ -11,7 +11,8 @@ units=$(SYSTEMUNIT) uuchar objpas macpas iso7185 strings \
       fpintres dos heaptrc lineinfo ctypes \
       sysutils fgl classes math typinfo \
       charset cpall getopts \
-      types rtlconsts sysconst character
+      types rtlconsts sysconst character \
+      athreads
 implicitunits=exeinfo cp1250 cp1251 cp1252 cp1253 cp1254 cp1255 cp1256 cp1257 cp1258 \
       cp437 cp646 cp850 cp856 cp866 cp874 cp8859_1 cp8859_5 cp8859_2 cp852 \
       unicodedata unicodenumtable
@@ -196,6 +197,9 @@ fpintres$(PPUEXT) : $(INC)/fpintres.pp $(SYSTEMUNIT)$(PPUEXT)
 # Other system-dependent RTL Units
 #
 
+athreads$(PPUEXT) : athreads.pp $(SYSTEMUNIT)$(PPUEXT)
+	$(COMPILER) $(AMIINC)/athreads.pp
+
 #exec$(PPUEXT)    : exec.pp execf.inc execd.inc
 
 #timer$(PPUEXT)   : timer.pp timerd.inc timerf.inc

+ 0 - 590
rtl/aros/arosthreads.inc

@@ -1,590 +0,0 @@
-
-type
-  TThreadEntryfunction = function(data: Pointer): Pointer; cdecl;
-
-
-  TMutextKind = (mkExclusive, mkShared);
-
-  TAROSMutex = record
-    Semaphore: TSignalSemaphore;
-  end;
-  PAROSMutex = ^TAROSMutex;
-  
-  TCondition = record
-    Lock: TSignalSemaphore;
-    Waiters: array of Pointer;
-  end;
-  PCondition = ^TCondition;
-
-  TAROSThread = record
-    Entry: TThreadEntryfunction;
-    Data: Pointer;
-    ThreadID: LongWord;
-    Priority: LongInt;
-    StackSize: LongInt;
-    Task: PProcess;
-    Lock: TSignalSemaphore;
-    StartupSemaphore: TSignalSemaphore;
-    EndCondition: PCondition;
-    EndMutex: PAROSMutex;
-    EndCount: Integer;
-  end;
-  PAROSThread = ^TAROSThread;
-  
-  TAROSThreadStruct = record
-    MutexListSem: TSignalSemaphore;
-    MutexList: array of PAROSMutex;
-    //
-    ThreadListSem: TSignalSemaphore;
-    ThreadList: array of PAROSThread;
-    //
-    ConditionListSem: TSignalSemaphore;
-    ConditionList: array of PCondition;
-    //
-    ThreadMemSem: TSignalSemaphore;
-    EmptySemaphore: TSignalSemaphore;
-    //
-    LastThreadNum: LongWord;
-  end;
-  PAROSThreadStruct = ^TAROSThreadStruct;
-
-var
-  AROSThreadStruct: PAROSThreadStruct external name 'AROS_THREADLIB';
-
-
-function CreateNewProcTags(const Tags: array of PtrUInt): PProcess;
-begin
-  CreateNewProcTags := CreateNewProc(@Tags[0]);
-end; 
-
-// Mutexe
-
-function CreateMutex: PAROSMutex;
-var
-  Mutex: PAROSMutex;
-  Idx, i: Integer;
-begin
-  if not Assigned(AROSThreadStruct) then
-    Exit;
-  New(Mutex);
-  InitSemaphore(@(Mutex^.Semaphore));
-  ObtainSemaphore(@(AROSThreadStruct^.MutexListSem));
-  Idx := -1;
-  for i := 0 to High(AROSThreadStruct^.MutexList) do
-  begin
-    if not Assigned(AROSThreadStruct^.MutexList[i]) then
-    begin
-      Idx := i;
-      Break;
-    end;
-  end;
-  if Idx < 0 then
-  begin
-    Idx := Length(AROSThreadStruct^.MutexList);
-    SetLength(AROSThreadStruct^.MutexList, Idx + 1);
-  end;
-  AROSThreadStruct^.MutexList[Idx] := Mutex;
-  ReleaseSemaphore(@(AROSThreadStruct^.MutexListSem));
-  Result := Mutex;
-end;
-
-procedure DestroyMutex(Mutex: PAROSMutex);
-var
-  i: Integer;
-begin
-  if not Assigned(AROSThreadStruct) then
-    Exit;
-  ObtainSemaphore(@(AROSThreadStruct^.MutexListSem));
-  for i := 0 to High(AROSThreadStruct^.MutexList) do
-  begin
-    if AROSThreadStruct^.MutexList[i] = Mutex then
-    begin
-      FillChar(Mutex^.Semaphore, SizeOf(TSignalSemaphore), 0);
-      Dispose(Mutex);
-      AROSThreadStruct^.MutexList[i] := nil;
-    end;
-  end;
-  ReleaseSemaphore(@(AROSThreadStruct^.MutexListSem));  
-end;
-
-
-function IsValidMutex(Mutex: PAROSMutex): Boolean;
-var
-  i: Integer;
-begin
-  Result := False;
-  if not Assigned(AROSThreadStruct) then
-    Exit;
-  ObtainSemaphore(@(AROSThreadStruct^.MutexListSem));
-  for i := 0 to High(AROSThreadStruct^.MutexList) do
-  begin
-    if AROSThreadStruct^.MutexList[i] = Mutex then
-    begin
-      Result := True;
-      Break;
-    end;
-  end;
-  ReleaseSemaphore(@(AROSThreadStruct^.MutexListSem));
-end;
-
-procedure LockMutex(Mutex: PAROSMutex);
-begin
-  if IsValidMutex(Mutex) then
-  begin
-    ObtainSemaphore(@(Mutex^.Semaphore));  
-  end;
-end;
-
-function TryLockMutex(Mutex: PAROSMutex): Boolean;
-begin
-  Result := False;
-  if IsValidMutex(Mutex) then
-  begin
-    Result := AttemptSemaphore(@(Mutex^.Semaphore)) <> 0;  
-  end;
-end;
-
-procedure UnLockMutex(Mutex: PAROSMutex);
-begin
-  if IsValidMutex(Mutex) then
-  begin
-    ReleaseSemaphore(@(Mutex^.Semaphore));  
-  end;
-end;
-
-// Conditions
-
-function CreateCondition: PCondition;
-var
-  Idx, i: Integer;
-  NewCond: PCondition;
-begin
-  if not Assigned(AROSThreadStruct) then
-    Exit;
-  New(NewCond);
-  SetLength(NewCond^.Waiters, 0);
-  InitSemaphore(@(NewCond^.Lock));
-  ObtainSemaphore(@(AROSThreadStruct^.ConditionListSem));
-  Idx := -1;
-  for i := 0 to High(AROSThreadStruct^.ConditionList) do
-  begin
-    if not Assigned(AROSThreadStruct^.ConditionList[i]) then
-    begin
-      Idx := i;
-      Break;
-    end;
-  end;
-  if Idx < 0 then
-  begin
-    Idx := Length(AROSThreadStruct^.ConditionList);
-    SetLength(AROSThreadStruct^.ConditionList, Idx + 1);
-  end;
-  AROSThreadStruct^.ConditionList[Idx] := NewCond;
-  ReleaseSemaphore(@(AROSThreadStruct^.ConditionListSem));
-  Result := NewCond;
-end;
-
-function DestroyCondition(Cond: PCondition): boolean;
-var
-  Idx, i: Integer;
-begin
-  if not Assigned(AROSThreadStruct) then
-    Exit;
-  ObtainSemaphore(@(Cond^.Lock));
-  if Length(Cond^.Waiters) > 0 then
-  begin
-    ReleaseSemaphore(@(Cond^.Lock));
-    Result := False;
-    Exit;
-  end;
-  ObtainSemaphore(@(AROSThreadStruct^.ConditionListSem));
-  Idx := -1;
-  for i := 0 to High(AROSThreadStruct^.ConditionList) do
-  begin
-    if AROSThreadStruct^.ConditionList[i] = Cond then
-    begin
-      AROSThreadStruct^.ConditionList[i] := nil;
-      Dispose(Cond);
-      Break;
-    end;
-  end;
-  ReleaseSemaphore(@(AROSThreadStruct^.ConditionListSem));
-  Result := True;
-end;
-
-function WaitCondition(Cond: PCondition; Mutex: PAROSMutex): boolean;
-var
-  Idx: Integer;
-begin
-  if (not Assigned(Cond)) or (not Assigned(Mutex)) then
-  begin
-    Result := False;
-    Exit;
-  end;
-  ObtainSemaphore(@Cond^.Lock);
-  Idx := Length(Cond^.Waiters);
-  SetLength(Cond^.Waiters, Idx + 1);
-  Cond^.Waiters[Idx] := FindTask(nil);
-  ReleaseSemaphore(@Cond^.Lock);
-  
-  Forbid();
-  UnLockMutex(Mutex);
-  Wait(SIGF_SINGLE);
-  Permit();
-  LockMutex(Mutex);
-  Result := True;
-end;
-
-procedure SignalCondition(Cond: PCondition);
-var
-  Waiter: PTask;
-  Idx: Integer;
-begin
-  if not Assigned(Cond) then
-    Exit;
-  ObtainSemaphore(@Cond^.Lock);
-  Waiter := nil;
-  //debugln(' found ' + IntToStr(Cond^.Waiters.Count) + ' Waiter');
-  if Length(Cond^.Waiters) > 0 then
-  begin
-    Idx := High(Cond^.Waiters);
-    Waiter := Cond^.Waiters[Idx];
-    SetLength(Cond^.Waiters, Idx);
-  end;  
-  ReleaseSemaphore(@Cond^.Lock);
-  if not Assigned(Waiter) then
-  begin
-    //debugln('Waiter not assigned');
-    Exit;
-  end;
-  //debugln('Signal Waiter');  
-  Signal(Waiter, SIGF_SINGLE);
-end;
-
-procedure BroadcastCondition(Cond: PCondition);
-var
-  Waiter: PTask;
-  I: Integer;
-begin
-  if not Assigned(Cond) then
-    Exit;
-  Waiter := nil;
-  ObtainSemaphore(@Cond^.Lock);
-  for i := 0 to High(Cond^.Waiters) do
-  begin
-    Waiter := Cond^.Waiters[i];
-    Signal(Waiter, SIGF_SINGLE);
-  end;
-  SetLength(Cond^.Waiters, 0);
-  ReleaseSemaphore(@Cond^.Lock);   
-end;
-
-// Threads
-
-procedure StarterFunc; cdecl;
-var
-  NewThread: PAROSThread;
-  StackMem: Pointer;
-  sswap: TStackSwapStruct; 
-  Proc: PTask;
-begin
-  Proc := FindTask(nil);
-  NewThread := PAROSThread(Proc^.tc_UserData);
-  // create New Stack
-  StackMem := GetMem(NewThread^.StackSize);
-  sswap.stk_Lower := StackMem;
-  sswap.stk_Upper := Pointer(PtrUInt(sswap.stk_Lower) + NewThread^.StackSize);
-  sswap.stk_Pointer := sswap.stk_Upper;
-  ReleaseSemaphore(@AROSThreadStruct^.ThreadMemSem);
-  // semaphore against too fast startup
-  ReleaseSemaphore(@(NewThread^.StartupSemaphore));
-  // swap stack, run program, swap stack back
-  Stackswap(@sswap);
-  NewThread^.Entry(NewThread^.Data);
-  Stackswap(@sswap);
-  //debugln('5');
-
-  // Free stack memory
-  ObtainSemaphore(@AROSThreadStruct^.ThreadMemSem);
-  FreeMem(StackMem);
-  ReleaseSemaphore(@AROSThreadStruct^.ThreadMemSem);
-  // finished mark as finished
-	ObtainSemaphore(@NewThread^.Lock);
-	NewThread^.Task := nil;
-	ReleaseSemaphore(@NewThread^.Lock);
-	// tell the others we are finished!
-	//Debugln('wait for end ' + IntToStr(NewThread^.ThreadId));
-	LockMutex(NewThread^.EndMutex);
-	BroadcastCondition(NewThread^.EndCondition);
-	UnLockMutex(NewThread^.EndMutex);
-	//Debugln('End ' + IntToStr(NewThread^.ThreadId));	
-end;
-
-procedure EmptyFunc;
-begin
-  DOSDelay(1);
-  ReleaseSemaphore(@AROSThreadStruct^.EmptySemaphore);
-end;
-
-
-function AROSCreateThread(Entry: TThreadEntryfunction; data: Pointer; StackSize: Integer = 262144; Priority: Integer = 0): LongWord;
-var
-  NewThread: PAROSThread;
-  Idx, i: Integer;
-begin
-  if not Assigned(AROSThreadStruct) then
-    Exit;
-  New(NewThread);
-  ObtainSemaphore(@AROSThreadStruct^.ThreadListSem);
-  Idx := -1;
-  for i := 0 to High(AROSThreadStruct^.ThreadList) do
-  begin
-    if not Assigned(AROSThreadStruct^.ThreadList[i]) then
-    begin
-      Idx := i;
-      Break;
-    end;
-  end;
-  if Idx < 0 then
-  begin
-    Idx := Length(AROSThreadStruct^.ThreadList);
-    SetLength(AROSThreadStruct^.ThreadList, Idx + 1);
-  end;
-  Inc(AROSThreadStruct^.LastThreadNum);
-  AROSThreadStruct^.ThreadList[Idx] := NewThread; 
-  NewThread^.ThreadID := AROSThreadStruct^.LastThreadNum;
-  NewThread^.Entry := Entry;
-  NewThread^.Data := Data;
-  NewThread^.Priority := Priority;
-  NewThread^.StackSize := StackSize;
-  InitSemaphore(@(NewThread^.Lock));
-  InitSemaphore(@(NewThread^.StartupSemaphore));
-  NewThread^.EndCondition := CreateCondition;
-  NewThread^.EndMutex := CreateMutex;
-  NewThread^.EndCount := 0;
-  ReleaseSemaphore(@AROSThreadStruct^.ThreadListSem);
-  
-  ObtainSemaphore(@AROSThreadStruct^.ThreadMemSem);
-  
-  // Semaphore for too fast startup
-  ObtainSemaphore(@(NewThread^.StartupSemaphore));
-  
-  // a very ugly Bugfix, for crashing AROS, on the very first Task after reboot
-  // recheck later if can be removed
-  if NewThread^.ThreadID  = 1 then
-  begin
-    //debugln('make empty thread');
-    ObtainSemaphore(@AROSThreadStruct^.EmptySemaphore);
-    NewThread^.Task := CreateNewProcTags([
-      NP_Entry, PtrUInt(@EmptyFunc),
-      TAG_DONE, TAG_END]);
-    ObtainSemaphore(@AROSThreadStruct^.EmptySemaphore);
-    DOSDelay(1);
-  end;
-  //
-  NewThread^.Task := CreateNewProcTags([
-    NP_Entry, PtrUInt(@StarterFunc),
-    //NP_Name, PtrUInt(PChar('Thread' + IntToStr(LastThreadNum))),
-    //NP_StackSize, 10024 * 1024,
-    NP_Priority, Priority, 
-    NP_UserData, PtrUInt(NewThread),
-    TAG_DONE, TAG_END]);
-  Result := NewThread^.ThreadID;
-end;
-
-function AROSCurrentThread: LongInt;
-var
-  Task: PProcess;
-  i: Integer;
-begin
-  Result := 0;
-  Task := PProcess(FindTask(nil));
-  ObtainSemaphore(@AROSThreadStruct^.ThreadListSem);
-  for i := 0 to High(AROSThreadStruct^.ThreadList) do
-  begin
-    if Assigned(AROSThreadStruct^.ThreadList[i]) then
-    begin
-      if AROSThreadStruct^.ThreadList[i]^.Task = Task then
-      begin
-        Result := AROSThreadStruct^.ThreadList[i]^.ThreadID;
-        Break;
-      end;  
-    end;
-  end; 
-  ReleaseSemaphore(@AROSThreadStruct^.ThreadListSem);
-end;
-
-
-function AROSWaitThread(ThreadID: LongWord): Boolean;
-var
-  Thread: PAROSThread;
-  Idx, i: Integer;
-begin
-  if not Assigned(AROSThreadStruct) then
-    Exit;
-  ObtainSemaphore(@AROSThreadStruct^.ThreadListSem);
-  Thread := nil;
-  Idx := -1;
-  for i := 0 to High(AROSThreadStruct^.ThreadList) do
-  begin
-    if Assigned(AROSThreadStruct^.ThreadList[i]) then
-    begin
-      if AROSThreadStruct^.ThreadList[i]^.ThreadID = ThreadID then
-      begin
-        Thread := AROSThreadStruct^.ThreadList[i];
-        Idx := i;
-        break;
-      end;  
-    end;
-  end;  
-  ReleaseSemaphore(@AROSThreadStruct^.ThreadListSem);
-  if Thread = nil then
-  begin
-    //debugln('Thread not found');
-    Result := False;
-    Exit;
-  end;
-  
-  // check some 
-  ObtainSemaphore(@Thread^.Lock);
-  // hmm thats me... I do not wait for myself
-  if Thread^.Task = PProcess(FindTask(nil)) then
-  begin
-    //debugln(' hmm its me :O ' + IntToStr(ThreadID));
-    ReleaseSemaphore(@Thread^.Lock);
-    Result := False;
-    Exit;
-  end;
-  // wait that the thread start is finished somehow ;)
-  ObtainSemaphore(@(Thread^.StartupSemaphore));
-  ReleaseSemaphore(@(Thread^.StartupSemaphore));
-  // check if Task is still running
-  if Thread^.Task <> nil then
-  begin
-    Inc(Thread^.EndCount);
-    ReleaseSemaphore(@Thread^.Lock);
-    LockMutex(Thread^.EndMutex);
-    //debugln(' Wait condition ' + IntToStr(ThreadID));
-    WaitCondition(Thread^.EndCondition, Thread^.EndMutex);
-    //debugln(' got condition ' + IntToStr(ThreadID));
-    UnlockMutex(Thread^.EndMutex);
-    ObtainSemaphore(@Thread^.Lock);  
-    Dec(Thread^.EndCount);
-  end;
-  if Thread^.EndCount > 0 then
-  begin
-    ReleaseSemaphore(@Thread^.Lock);
-    Result := True;
-    Exit;  
-  end;
-  if Assigned(AROSThreadStruct) then
-  begin
-    // destroy Thread
-    ObtainSemaphore(@AROSThreadStruct^.ThreadListSem);
-    AROSThreadStruct^.ThreadList[Idx] := nil;
-    ReleaseSemaphore(@AROSThreadStruct^.ThreadListSem);
-  end;
-  DestroyCondition(Thread^.EndCondition);
-  DestroyMutex(Thread^.EndMutex);
-  Dispose(Thread);
-  Result := true;
-end;
-
-function AROSCurrentThread: LongWord;
-var
-  i: Integer;
-  CurTask: PProcess;
-begin
-  if not Assigned(AROSThreadStruct) then
-    Exit;
-  Result := 0;
-  ObtainSemaphore(@AROSThreadStruct^.ThreadListSem);
-  CurTask := PProcess(FindTask(nil));
-  for i := 0 to High(AROSThreadStruct^.ThreadList) do
-  begin
-    if Assigned(AROSThreadStruct^.ThreadList[i]) then
-    begin
-      if AROSThreadStruct^.ThreadList[i]^.Task = CurTask then
-      begin
-        Result := AROSThreadStruct^.ThreadList[i]^.ThreadID;
-        Break;
-      end;
-    end;
-  end;
-  ReleaseSemaphore(@AROSThreadStruct^.ThreadListSem);
-end;
-
-
-procedure WaitAllThreads;
-var
-  i: Integer;
-  TID: LongWord;
-begin
-  if not Assigned(AROSThreadStruct) then
-    Exit;
-  ObtainSemaphore(@AROSThreadStruct^.ThreadListSem);
-  i := 0; 
-  while i <= High(AROSThreadStruct^.ThreadList) do
-  begin
-    if Assigned(AROSThreadStruct^.ThreadList[i]) then
-    begin
-      TID := AROSThreadStruct^.ThreadList[i]^.ThreadID;      
-      //
-      ObtainSemaphore(@(AROSThreadStruct^.ThreadList[i]^.StartupSemaphore));
-      ReleaseSemaphore(@(AROSThreadStruct^.ThreadList[i]^.StartupSemaphore));
-      //
-      ReleaseSemaphore(@AROSThreadStruct^.ThreadListSem);
-      AROSWaitThread(TID);
-      ObtainSemaphore(@AROSThreadStruct^.ThreadListSem); 
-    end;  
-    Inc(i);
-  end;
-  ReleaseSemaphore(@AROSThreadStruct^.ThreadListSem);
-end;
-
-{$ifdef THREAD_SYSTEM}
-
-procedure InitThreadLib;
-begin
-  New(AROSThreadStruct);
-  AROSThreadStruct^.LastThreadNum := 0;
-  InitSemaphore(@(AROSThreadStruct^.MutexListSem));
-  InitSemaphore(@(AROSThreadStruct^.ConditionListSem));
-  InitSemaphore(@(AROSThreadStruct^.ThreadListSem));
-  InitSemaphore(@(AROSThreadStruct^.ThreadMemSem));
-  InitSemaphore(@(AROSThreadStruct^.EmptySemaphore));
-end;
-
-procedure FinishThreadLib;
-var
-  i: Integer;
-begin
-  if not Assigned(AROSThreadStruct) then
-    Exit;
-  WaitAllThreads;
-  ObtainSemaphore(@AROSThreadStruct^.MutexListSem);
-  i := 0;
-  for i := 0 to High(AROSThreadStruct^.MutexList) do
-  begin
-    if Assigned(AROSThreadStruct^.MutexList[i]) then
-    begin
-      Dispose(AROSThreadStruct^.MutexList[i]);
-    end;  
-  end;
-  ReleaseSemaphore(@AROSThreadStruct^.MutexListSem);
-  ObtainSemaphore(@AROSThreadStruct^.ConditionListSem);
-  i := 0;
-  for i := 0 to High(AROSThreadStruct^.ConditionList) do
-  begin
-    if Assigned(AROSThreadStruct^.ConditionList[i]) then
-    begin
-      Dispose(AROSThreadStruct^.ConditionList[i]);
-    end;  
-  end;
-  ReleaseSemaphore(@AROSThreadStruct^.ConditionListSem);
-  Dispose(AROSThreadStruct);
-  AROSThreadStruct := nil;
-end;
-
-{$endif THREAD_SYSTEM}
-

+ 5 - 2
rtl/aros/system.pp

@@ -25,8 +25,6 @@ interface
 
 {$define FPC_IS_SYSTEM}
 
-{$define DISABLE_NO_THREAD_MANAGER}
-
 {$I systemh.inc}
 {$I osdebugh.inc}
 
@@ -120,6 +118,11 @@ begin
   if Killed then
     Exit;
   Killed := True;
+
+  { Dispose the thread init/exit chains }
+  CleanupThreadProcChain(threadInitProcList);
+  CleanupThreadProcChain(threadExitProcList);
+
   { Closing opened files }
   CloseList(ASYS_fileList);
   { Changing back to original directory if changed }

+ 0 - 2
rtl/aros/systemthreadh.inc

@@ -1,2 +0,0 @@
-
-

+ 0 - 359
rtl/aros/systhrd.inc

@@ -1,359 +0,0 @@
-{
-    This file is part of the Free Pascal run time library.
-    Copyright (c) 2013 by Marcus Sackrow.
-
-    See the file COPYING.FPC, included in this distribution,
-    for details about the copyright.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-
- **********************************************************************}
-
-
-
-//type
-//  TThreadEntryfunction = function(data: Pointer): Pointer; cdecl;
-
-const
-   threadvarblocksize : dword = 0;     // total size of allocated threadvars
-   thredvarsmainthread: pointer = nil; // to free the threadvars in the signal handler
-
-var
-  ThreadsVarList: array of Pointer;
-
-{$define THREAD_SYSTEM}
-{$I arosthreads.inc}
-
-// Thread manager:
-procedure SysInitThreadvar(var offset : dword;size : dword);
-begin
-  //offset:=threadvarblocksize;
-  //inc(threadvarblocksize,size);
-end;
-
-procedure SaveThreadVars(t: Pointer);
-var
-  Idx: Integer;
-begin
-  {Idx := AROSCurrentThread();
-  if Idx >= 0 then
-  begin
-    if Idx > High(ThreadsVarList) then
-      SetLength(ThreadsVarList, Idx + 1);
-    ThreadsVarList[Idx] := t;  
-  end;}
-end;
-
-function GetThreadV: Pointer;
-var
-  Idx: Integer;
-begin
-  {
-  Result := nil;
-  Idx := AROSCurrentThread();
-  if (Idx >= 0) and (Idx <= High(ThreadsVarList)) then
-  begin
-    Result := ThreadsVarList[Idx];  
-  end;
-  }
-end;
-
-function SysRelocateThreadvar (offset: dword): Pointer;
-begin
-  //SysRelocateThreadvar:= GetThreadV + offset; 
-end;
-
-procedure SaveThreadV(t: Pointer);
-var
-  Idx: Integer;
-begin
-  {Idx := AROSCurrentThread();
-  if Idx >= 0 then
-  begin
-    if Idx > High(ThreadsVarList) then
-      SetLength(ThreadsVarList, Idx + 1);
-    ThreadsVarList[Idx] := t;  
-  end;}
-end;
-
-procedure SysAllocateThreadVars;
-var
-  threadvars: Pointer;
-begin
-  {threadvars := AllocPooled(AOS_heapPool, threadvarblocksize);
-  FillChar(threadvars^, threadvarblocksize, 0);
-  SaveThreadV(threadvars);
-  if thredvarsmainthread = nil then
-    thredvarsmainthread := threadvars;}
-end;
-
-procedure SysReleaseThreadVars;
-var
-  threadvars: Pointer;
-begin
-  { release thread vars }
-  {
-  if threadvarblocksize > 0 then
-  begin
-    threadvars := GetThreadV;
-    if threadvars <> nil then
-    begin
-      FreePooled(AOS_heapPool, threadvars, threadvarblocksize);
-      SaveThreadVars(nil);
-    end;
-  end;}
-end;
-
-type
-   TThreadInfo = record
-      F: TThreadfunc;
-      P: Pointer;
-   end;
-   PThreadinfo = ^TThreadinfo;
-
-function ThreadFunc(Data: Pointer): Pointer; cdecl;
-var
-  Ti: TThreadinfo; 
-begin
-  {SysAllocateThreadVars;
-  ti := PThreadInfo(Data)^;
-  Dispose(PThreadInfo(Data));
-  // execute
-  ThreadFunc := Pointer(Ti.f(Ti.p));
-  DoneThread;} 
-end;
-
-function SysBeginThread(Sa: Pointer; StackSize: PtrUInt; ThreadFunction: TThreadfunc; p: Pointer; CreationFlags: dword; var ThreadId: TThreadID): TThreadID;
-var
-  Ti: PThreadinfo;
-begin
-  Result := 0;
-  if not IsMultiThread then
-  begin
-    InitThreadVars(@SysRelocateThreadvar);
-    IsMultithread:=true;
-  end;
-  New(Ti);
-  Ti^.f := ThreadFunction;
-  Ti^.p := p;
-  SetLength(ThreadsVarList, 200);
-  //SysBeginThread := CreateThread(@ThreadFunc, Ti);
-  ThreadID := SysBeginThread;
-end;
-
-
-procedure SysEndThread(ExitCode : DWord);
-begin 
-  DoneThread;
-  //ExitThread(Pointer(ExitCode));
-end;
-
-
-procedure SysThreadSwitch;
-begin
-  DOSDelay(0);
-end;
-
-function SysSuspendThread(ThreadHandle: THandle): dword;
-begin
-  Result := 0;
-end;
-
-
-function SysResumeThread(ThreadHandle: THandle): dword;
-begin
-  Result := 0;
-end;
-
-
-function  SysKillThread(threadHandle: THandle): dword;
-begin
-  SysKillThread := 0;  {not supported for AROS}
-end;
-
-function SysWaitForThreadTerminate(threadHandle: THandle; TimeoutMs: LongInt): dword;
-begin
-  Result := 0; 
-end;
-
-function  SysThreadSetPriority (threadHandle : THandle; Prio: longint): boolean; {-15..+15, 0=normal}
-begin
-  SysThreadSetPriority := true;
-end;
-
-function  SysThreadGetPriority (threadHandle : THandle): Longint;
-begin
-  SysThreadGetPriority := 0;
-end;
-
-
-function SysGetCurrentThreadId: LongInt;
-begin
-  SysGetCurrentThreadId := AROSCurrentThread;
-end;
-
-// Close all Semaphores
-procedure SysCloseAllRemainingSemaphores;
-var
-  i: Integer;
-begin
-  ObtainSemaphore(@AROSThreadStruct^.MutexListSem);
-  i := 0;
-  for i := 0 to High(AROSThreadStruct^.MutexList) do
-  begin
-    if Assigned(AROSThreadStruct^.MutexList[i]) then
-    begin
-      Dispose(AROSThreadStruct^.MutexList[i]);
-    end;  
-  end;
-  ReleaseSemaphore(@AROSThreadStruct^.MutexListSem);
-end;
-
-// Critical Sections (done by Mutex)
-procedure SysInitCriticalSection(var cs: TRTLCriticalSection);
-begin
-  cs := CreateMutex;
-  //DebugLn('Create Mutex');
-end;
-
-procedure SysDoneCriticalsection(var cs: TRTLCriticalSection);
-begin
-  //DebugLn('Destroy Mutex');
-  if Assigned(cs) then
-    DestroyMutex(TRTLCriticalSection(cs));
-  cs := nil;  
-end;
-
-procedure SysEnterCriticalsection(var cs: TRTLCriticalSection);
-begin
-  //DebugLn('EnterMutex');
-  if Assigned(cs) then
-    LockMutex(cs);
-end;
-
-function SysTryEnterCriticalsection(var cs: TRTLCriticalSection): longint;
-begin
-  //DebugLn('TryEnter Mutex');
-  Result := 0;
-  if Assigned(cs) then
-    Result := LongInt(TryLockMutex(cs));
-end;
-
-procedure SysLeaveCriticalsection(var cs: TRTLCriticalSection);
-begin
-  //DebugLn('Leave Mutex');
-  if Assigned(cs) then
-    UnlockMutex(cs);
-end;
-
-function SysSetThreadDataAreaPtr (newPtr:pointer):pointer;
-begin
-end;
-
-function intBasicEventCreate(EventAttributes : Pointer;
-AManualReset,InitialState : Boolean;const Name : ansistring):pEventState;
-begin
-end;
-
-procedure intbasiceventdestroy(state:peventstate);
-begin
-end;
-
-procedure intbasiceventResetEvent(state:peventstate);
-begin
-end;
-
-procedure intbasiceventSetEvent(state:peventstate);
-begin
-end;
-
-function intbasiceventWaitFor(Timeout : Cardinal;state:peventstate) : longint;
-begin
-end;
-
-function intRTLEventCreate: PRTLEvent;
-begin
-end;
-
-procedure intRTLEventDestroy(AEvent: PRTLEvent);
-begin
-end;
-
-procedure intRTLEventSetEvent(AEvent: PRTLEvent);
-begin
-end;
-
-procedure intRTLEventResetEvent(AEvent: PRTLEvent);
-begin
-end;
-
-procedure intRTLEventWaitFor(AEvent: PRTLEvent);
-begin
-end;
-
-procedure intRTLEventWaitForTimeout(AEvent: PRTLEvent;timeout : longint);
-begin
-end;
-
-
-function SysInitManager: Boolean;
-begin
-  InitThreadLib;
-  Result := True;
-end;
-
-function SysDoneManager: Boolean;
-begin
-  FinishThreadLib;
-  Result := True;
-end;
-
-
-Var
-  AROSThreadManager : TThreadManager;
-
-procedure InitSystemThreads;
-begin
-  
-  with AROSThreadManager do
-  begin
-    InitManager            :=@SysInitManager;
-    DoneManager            :=@SysDoneManager;
-    BeginThread            :=@SysBeginThread;
-    EndThread              :=@SysEndThread;
-    SuspendThread          :=@SysSuspendThread;
-    ResumeThread           :=@SysResumeThread;
-    KillThread             :=@SysKillThread;
-    ThreadSwitch           :=@SysThreadSwitch;
-    WaitForThreadTerminate :=@SysWaitForThreadTerminate;
-    ThreadSetPriority      :=@SysThreadSetPriority;
-    ThreadGetPriority      :=@SysThreadGetPriority;
-    GetCurrentThreadId     :=@SysGetCurrentThreadId;
-    InitCriticalSection    :=TCriticalSectionHandler(@SysInitCriticalSection);
-    DoneCriticalSection    :=TCriticalSectionHandler(@SysDoneCriticalSection);
-    EnterCriticalSection   :=TCriticalSectionHandler(@SysEnterCriticalSection);
-    LeaveCriticalSection   :=TCriticalSectionHandler(@SysLeaveCriticalSection);
-    InitThreadVar          :=@SysInitThreadVar;
-    RelocateThreadVar      :=@SysRelocateThreadVar;
-    AllocateThreadVars     :=@SysAllocateThreadVars;
-    ReleaseThreadVars      :=@SysReleaseThreadVars;
-    BasicEventCreate       :=@intBasicEventCreate;
-    basiceventdestroy      :=@intbasiceventdestroy;
-    basiceventResetEvent   :=@intbasiceventResetEvent;
-    basiceventSetEvent     :=@intbasiceventSetEvent;
-    basiceventWaitFor      :=@intbasiceventWaitFor;
-    RTLEventCreate         :=@intRTLEventCreate;
-    RTLEventDestroy        :=@intRTLEventDestroy;
-    RTLEventSetEvent       :=@intRTLEventSetEvent;
-    RTLEventResetEvent     :=@intRTLEventResetEvent;
-    RTLEventWaitFor        :=@intRTLEventWaitFor;
-    RTLEventWaitForTimeout :=@intRTLEventWaitForTimeout;
-  end;
-  SetThreadManager(AROSThreadManager); 
-  
-end;
-
-
-

+ 0 - 161
rtl/aros/tthread.inc

@@ -1,161 +0,0 @@
-{$include execd.inc}
-{$include execf.inc}
-{$include timerd.inc}
-{$include doslibd.inc}
-{$include doslibf.inc}
-{$include arosthreads.inc}
-
-function ThreadFunc(Data: Pointer): Pointer; cdecl;
-var
-  LThread: TThread;
-  LFreeOnTerminate: Boolean;
-  ISuspended: Boolean;
-begin
-  //Debugln('Enter ThreadFunc');
-  Result := nil;
-  LThread := TThread(Data);
-  ISuspended := LThread.FInitialSuspended;
-  if ISuspended then
-  begin
-    if not LThread.FTerminated then
-    begin
-      LockMutex(LThread.FSem);
-      WaitCondition(LThread.FCond, LThread.FSem);
-      UnlockMutex(LThread.FSem);
-    end;  
-  end;
-  //Sleep(1);
-  if not LThread.FTerminated then
-  begin
-    //Debugln('Execute Thread');
-    try
-      LThread.Execute;     
-    except
-      on E: Exception do
-      begin
-        //DebugLn('Exception in Thread '+ e.Classname + e.MEssage);
-        LThread.FFatalException := TObject(AcquireExceptionObject);
-        if E is EThreadDestroyCalled then
-           LThread.FFreeOnTerminate := true; 
-      end;
-    end;
-    //Debugln('Back from Thread'); 
-    //Sleep(1);            
-  end;    
-  LFreeOnTerminate := LThread.FreeOnTerminate;
-  LThread.DoTerminate;
-  LThread.FFinished := True;
-  if LFreeOnTerminate then
-    LThread.Free;
-  //debugln('Finished Thread?, then what to do now?')  
-end;
-
-procedure TThread.SysCreate(CreateSuspended: Boolean; const StackSize: SizeUInt);
-begin
-  if not Assigned(AROSThreadStruct) then
-    raise EThread.CreateFmt(SThreadCreateError, ['ThreadLib not found']);
-  
-  FSuspended := CreateSuspended;
-  FInitialSuspended := CreateSuspended;
-  
-  // Mutex for suspend actions
-  FSem := CreateMutex;
-  FCond := CreateCondition;
-  
-  FHandle := AROSCreateThread(@ThreadFunc, Self, StackSize);
-  FThreadID := FHandle;
-  if FHandle = 0 then
-    raise EThread.CreateFmt(SThreadCreateError, ['Cannot Create Thread']);
-  // exception if Thread cannot be created
-  FFatalException := nil;
-end;
-
-
-procedure TThread.SysDestroy;
-begin
-  if FHandle <> 0 then
-  begin
-    if not FFinished then
-    begin
-      Terminate;
-      if FSuspended then
-      begin
-        SignalCondition(FCond);
-        Sleep(0);
-      end;
-      WaitFor;
-    end;
-  end;
-  FHandle := 0;
-  DestroyCondition(FCond);
-  DestroyMutex(FSem);
-  FFatalException := nil;
-end;
-
-procedure TThread.CallOnTerminate;
-begin
-  FOnTerminate(Self);
-end;
-
-procedure TThread.DoTerminate;
-begin
-  if Assigned(FOnTerminate) then
-    Synchronize(@CallOnTerminate);
-end;
-
-function TThread.GetPriority: TThreadPriority;
-begin
-  //
-end;
-
-procedure TThread.SetPriority(Value: TThreadPriority);
-begin
-  //
-end;
-
-procedure TThread.SetSuspended(Value: Boolean);
-begin
-  if Value <> FSuspended then
-    if Value then
-      Suspend
-    else
-      Resume;
-end;
-
-procedure TThread.Suspend;
-begin
-  if FThreadID = GetCurrentThreadID then
-  begin
-    FSuspended := True;
-    LockMutex(FSem);
-    WaitCondition(FCond, FSem);
-    UnlockMutex(FSem);
-  end else
-    Raise EThread.create('Suspending one thread from inside another one is unsupported (because it is unsafe and deadlock prone) by AROS');  
-end;
-
-procedure TThread.Resume;
-begin
-  if FSuspended then
-  begin
-    SignalCondition(FCond);
-    Sleep(100);
-  end;
-  FSuspended := False;
-  FInitialSuspended := False;
-end;
-
-procedure TThread.Terminate;
-begin
-  FTerminated := True;
-end;
-
-function TThread.WaitFor: Integer;
-begin
-  Result := 0;
-  if (not FSuspended) and (FHandle <> 0) then
-  begin
-    Sleep(1);
-    AROSWaitThread(FHandle);
-  end;  
-end;

+ 1 - 8
rtl/objpas/classes/classesh.inc

@@ -1635,14 +1635,7 @@ type
     FSuspendedExternal: boolean;
     FPid: LongInt;
 {$endif}
-{$ifdef aros}
-  private
-    // see tthread.inc, ThreadFunc and TThread.Resume
-    FSem: Pointer;
-    FCond: Pointer;
-    FInitialSuspended: boolean;
-{$endif}
-{$if defined(amiga) or defined(morphos)}
+{$if defined(hasamiga)}
   private
     FInitialSuspended: boolean;
 {$endif}