Jelajahi Sumber

Amiga-likes: preparations for inclusion of AThreads into the RTL buildprocess

git-svn-id: trunk@30923 -
Károly Balogh 10 tahun lalu
induk
melakukan
6afcca7cd3

+ 6 - 1
rtl/amicommon/sysosh.inc

@@ -31,6 +31,11 @@ type
   TRTLCriticalSection = record
     { This must actually be bigger or equal to sizeof(TSignalSemaphore)
       which seems to be 46 bytes on MorphOS and Amiga/m68k. }
-    semaphore: array[0..63] of byte; 
+    semaphore: array[0..63] of byte;
   end;
 {$ENDIF}
+
+{ BeginThread flags we support in AThreads }
+const
+  CREATE_SUSPENDED = 1;
+  STACK_SIZE_PARAM_IS_A_RESERVATION = 2;

+ 2 - 2
rtl/amicommon/sysutils.pp

@@ -63,7 +63,7 @@ uses
 {$i sysutils.inc}
 
 
-{ * Include sytem specific includes * }
+{ * Include system specific includes * }
 {$include execd.inc}
 {$include execf.inc}
 {$include timerd.inc}
@@ -900,7 +900,7 @@ end;
 procedure Sleep(Milliseconds: cardinal);
 begin
   // Amiga dos.library Delay() has precision of 1/50 seconds
-  Delay(Milliseconds div 20);
+  DOSDelay(Milliseconds div 20);
 end;
 
 

+ 1 - 1
rtl/amiga/m68k/doslibf.inc

@@ -111,7 +111,7 @@ SysCall AOS_DOSBase 186;
 function DateStamp(date: PDateStamp location 'd1'): PDateStamp;
 SysCall AOS_DOSBase 192;
 
-procedure Delay(timeout: LongInt location 'd1');
+procedure DOSDelay(timeout: LongInt location 'd1');
 SysCall AOS_DOSBase 198;
 
 function WaitForChar(file1  : LongInt location 'd1';

+ 2 - 2
rtl/aros/arosthreads.inc

@@ -322,7 +322,7 @@ end;
 
 procedure EmptyFunc;
 begin
-  Delay(1);
+  DOSDelay(1);
   ReleaseSemaphore(@AROSThreadStruct^.EmptySemaphore);
 end;
 
@@ -379,7 +379,7 @@ begin
       NP_Entry, PtrUInt(@EmptyFunc),
       TAG_DONE, TAG_END]);
     ObtainSemaphore(@AROSThreadStruct^.EmptySemaphore);
-    Delay(1);
+    DOSDelay(1);
   end;
   //
   NewThread^.Task := CreateNewProcTags([

+ 1 - 1
rtl/aros/i386/doslibf.inc

@@ -34,7 +34,7 @@ function IoErr: longint; syscall AOS_DOSBase 22;
 procedure dosExit(ErrCode: longint); syscall AOS_DOSBase 24;
 function SetProtection(const name: PChar; protect: longword): LongInt; syscall AOS_DOSBase 31;
 function DateStamp(date: PDateStamp): PDateStamp; syscall AOS_DOSBase 32;
-procedure Delay(ticks: LongWord); syscall AOS_DOSBase 33;
+procedure dosDelay(ticks: LongWord); syscall AOS_DOSBase 33;
 function AllocDosObject(Type_: LongWord; const Tags: PTagItem): Pointer; syscall AOS_DOSBase 38;
 procedure FreeDosObject(Type_: LongWord; Ptr: Pointer); syscall AOS_DOSBase 39;
 function SetFileDate(name: PChar; date: PDateStamp): LongBool; syscall AOS_DOSBase 66;

+ 5 - 1
rtl/aros/i386/execf.inc

@@ -2,7 +2,7 @@
     This file is part of the Free Pascal run time library.
     Copyright (c) 2006 Karoly Balogh
 
-    exec functions (V40) for Amiga/PowerPC
+    exec functions for AROS/i386
 
     See the file COPYING.FPC, included in this distribution,
     for details about the copyright.
@@ -28,6 +28,7 @@ function AllocSignal(signalNum: LongInt): ShortInt; syscall LocalExecBase 55;
 procedure FreeSignal(signalNum: LongInt); syscall LocalExecBase 56;
 procedure AddPort(port: PMsgPort); syscall LocalExecBase 59;
 procedure RemPort(port: PMsgPort); syscall LocalExecBase 60;
+procedure PutMsg(Port: PMsgPort; Message: PMessage); syscall AOS_ExecBase 61;
 function GetMsg(port: PMsgPort): PMessage; syscall LocalExecBase 62;
 procedure ReplyMsg(message : pMessage); syscall LocalExecBase 63;
 function WaitPort(port: PMsgPort): PMessage; syscall LocalExecBase 64;
@@ -40,6 +41,9 @@ procedure InitSemaphore(SigSem: PSignalSemaphore); syscall AOS_ExecBase 93;
 procedure ObtainSemaphore(SigSem: PSignalSemaphore); syscall AOS_ExecBase 94;
 procedure ReleaseSemaphore(SigSem: PSignalSemaphore); syscall AOS_ExecBase 95;
 function AttemptSemaphore(SigSem: PSignalSemaphore): LongWord; syscall AOS_ExecBase 96;
+function CreateMsgPort: PMsgPort; syscall AOS_ExecBase 111;
+procedure DeleteMsgPort(Port: PMsgPort); syscall AOS_ExecBase 112;
+procedure ObtainSemaphoreShared(SigSem: PSignalSemaphore); syscall AOS_ExecBase 113;
 function CreatePool(requirements: Cardinal; puddleSize: Cardinal; threshSize: Cardinal): Pointer; syscall LocalExecBase 116;
 procedure DeletePool(poolHeader: Pointer); syscall LocalExecBase 117;
 function AllocPooled(poolHeader: Pointer; memSize: Cardinal): Pointer; syscall LocalExecBase 118;

+ 1 - 1
rtl/aros/systhrd.inc

@@ -153,7 +153,7 @@ end;
 
 procedure SysThreadSwitch;
 begin
-  Delay(0);
+  DOSDelay(0);
 end;
 
 function SysSuspendThread(ThreadHandle: THandle): dword;

+ 1 - 1
rtl/morphos/doslibf.inc

@@ -114,7 +114,7 @@ SysCall MOS_DOSBase 186;
 function DateStamp(date: PDateStamp location 'd1'): PDateStamp;
 SysCall MOS_DOSBase 192;
 
-procedure Delay(timeout: LongInt location 'd1');
+procedure DOSDelay(timeout: LongInt location 'd1');
 SysCall MOS_DOSBase 198;
 
 function WaitForChar(file1  : LongInt location 'd1';