浏览代码

+ TThreadID

florian 20 年之前
父节点
当前提交
4aa4aeae79

+ 7 - 3
rtl/beos/system.pp

@@ -27,8 +27,9 @@ interface
 {$I systemh.inc}
 {$I systemh.inc}
 
 
 type
 type
- THandle = longint;
-
+  THandle = longint;
+  TThreadID = THandle;
+  
 { include heap support headers }
 { include heap support headers }
 
 
 {$I heaph.inc}
 {$I heaph.inc}
@@ -547,7 +548,10 @@ begin
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.22  2005-04-03 21:10:59  hajny
+  Revision 1.23  2005-04-13 20:10:50  florian
+    + TThreadID
+
+  Revision 1.22  2005/04/03 21:10:59  hajny
     * EOF_CTRLZ conditional define replaced with CtrlZMarksEOF, #26 handling made more consistent (fix for bug 2453)
     * EOF_CTRLZ conditional define replaced with CtrlZMarksEOF, #26 handling made more consistent (fix for bug 2453)
 
 
   Revision 1.21  2005/02/14 17:13:21  peter
   Revision 1.21  2005/02/14 17:13:21  peter

+ 6 - 2
rtl/bsd/sysosh.inc

@@ -20,7 +20,8 @@
 type
 type
   { fd are int in C also for 64bit targets (x86_64) }
   { fd are int in C also for 64bit targets (x86_64) }
   THandle = Longint;
   THandle = Longint;
-
+  TThreadID = THandle;
+  
   { pthread_mutex_t }
   { pthread_mutex_t }
   PRTLCriticalSection = ^TRTLCriticalSection;
   PRTLCriticalSection = ^TRTLCriticalSection;
   TRTLCriticalSection = record
   TRTLCriticalSection = record
@@ -37,7 +38,10 @@ type
 
 
 {
 {
    $Log$
    $Log$
-   Revision 1.2  2005-02-14 17:13:21  peter
+   Revision 1.3  2005-04-13 20:10:50  florian
+     + TThreadID
+
+   Revision 1.2  2005/02/14 17:13:21  peter
      * truncate log
      * truncate log
 
 
    Revision 1.1  2005/02/06 12:16:52  peter
    Revision 1.1  2005/02/06 12:16:52  peter

+ 19 - 14
rtl/emx/sysosh.inc

@@ -19,24 +19,29 @@
 {Platform specific information}
 {Platform specific information}
 type
 type
   THandle = Longint;
   THandle = Longint;
-
-    { the fields of this record are os dependent  }
-    { and they shouldn't be used in a program     }
-    { only the type TCriticalSection is important }
-    PRTLCriticalSection = ^TRTLCriticalSection;
-    TRTLCriticalSection = packed record
-      DebugInfo : pointer;
-      LockCount : longint;
-      RecursionCount : longint;
-      OwningThread : DWord;
-      LockSemaphore : DWord;
-      Reserved : DWord;
-    end;
+  
+  TThreadID = THandle;
+  
+  { the fields of this record are os dependent  }
+  { and they shouldn't be used in a program     }
+  { only the type TCriticalSection is important }
+  PRTLCriticalSection = ^TRTLCriticalSection;
+  TRTLCriticalSection = packed record
+    DebugInfo : pointer;
+    LockCount : longint;
+    RecursionCount : longint;
+    OwningThread : DWord;
+    LockSemaphore : DWord;
+    Reserved : DWord;
+  end;
 
 
 
 
 {
 {
    $Log$
    $Log$
-   Revision 1.1  2005-02-06 16:57:18  peter
+   Revision 1.2  2005-04-13 20:10:50  florian
+     + TThreadID
+
+   Revision 1.1  2005/02/06 16:57:18  peter
      * threads for go32v2,os,emx,netware
      * threads for go32v2,os,emx,netware
 
 
    Revision 1.1  2005/02/06 13:06:20  peter
    Revision 1.1  2005/02/06 13:06:20  peter

+ 10 - 6
rtl/go32v2/sysosh.inc

@@ -19,16 +19,20 @@
 {Platform specific information}
 {Platform specific information}
 type
 type
   THandle = Longint;
   THandle = Longint;
-
-     PRTLCriticalSection = ^TRTLCriticalSection;
-     TRTLCriticalSection = record
-       Locked: boolean
-     end;
+  TThreadID = THandle;
+  
+   PRTLCriticalSection = ^TRTLCriticalSection;
+   TRTLCriticalSection = record
+     Locked: boolean
+   end;
 
 
 
 
 {
 {
    $Log$
    $Log$
-   Revision 1.1  2005-02-06 16:57:18  peter
+   Revision 1.2  2005-04-13 20:10:50  florian
+     + TThreadID
+
+   Revision 1.1  2005/02/06 16:57:18  peter
      * threads for go32v2,os,emx,netware
      * threads for go32v2,os,emx,netware
 
 
    Revision 1.1  2005/02/06 13:06:20  peter
    Revision 1.1  2005/02/06 13:06:20  peter

+ 18 - 15
rtl/inc/threadh.inc

@@ -3,7 +3,7 @@
     This file is part of the Free Pascal Run time library.
     This file is part of the Free Pascal Run time library.
     Copyright (c) 2000 by the Free Pascal development team
     Copyright (c) 2000 by the Free Pascal development team
 
 
-    This File contains the OS indenpendend declartions for multi
+    This file contains the OS indenpendend declartions for multi
     threading support in FPC
     threading support in FPC
 
 
     See the File COPYING.FPC, included in this distribution,
     See the File COPYING.FPC, included in this distribution,
@@ -26,15 +26,15 @@ type
   trtlmethod  = procedure of object;
   trtlmethod  = procedure of object;
 
 
   // Function prototypes for TThreadManager Record.
   // Function prototypes for TThreadManager Record.
-  TBeginThreadHandler = Function (sa : Pointer;stacksize : dword; ThreadFunction : tthreadfunc;p : pointer;creationFlags : dword; var ThreadId : THandle) : DWord;
+  TBeginThreadHandler = Function (sa : Pointer;stacksize : dword; ThreadFunction : tthreadfunc;p : pointer;creationFlags : dword; var ThreadId : TThreadID) : DWord;
   TEndThreadHandler = Procedure (ExitCode : DWord);
   TEndThreadHandler = Procedure (ExitCode : DWord);
   // Used for Suspend/Resume/Kill
   // Used for Suspend/Resume/Kill
-  TThreadHandler = Function (threadHandle : dword) : dword;
+  TThreadHandler = Function (threadHandle : TThreadID) : dword;
   TThreadSwitchHandler = Procedure;
   TThreadSwitchHandler = Procedure;
-  TWaitForThreadTerminateHandler = Function (threadHandle : dword; TimeoutMs : longint) : dword;  {0=no timeout}
-  TThreadSetPriorityHandler = Function (threadHandle : dword; Prio: longint): boolean;            {-15..+15, 0=normal}
-  TThreadGetPriorityHandler = Function (threadHandle : dword): longint;
-  TGetCurrentThreadIdHandler = Function : dword;
+  TWaitForThreadTerminateHandler = Function (threadHandle : TThreadID; TimeoutMs : longint) : dword;  {0=no timeout}
+  TThreadSetPriorityHandler = Function (threadHandle : TThreadID; Prio: longint): boolean;            {-15..+15, 0=normal}
+  TThreadGetPriorityHandler = Function (threadHandle : TThreadID): longint;
+  TGetCurrentThreadIdHandler = Function : TThreadID;
   TCriticalSectionHandler = Procedure (var cs);
   TCriticalSectionHandler = Procedure (var cs);
   TInitThreadVarHandler = Procedure(var offset : dword;size : dword);
   TInitThreadVarHandler = Procedure(var offset : dword;size : dword);
   TRelocateThreadVarHandler = Function(offset : dword) : pointer;
   TRelocateThreadVarHandler = Function(offset : dword) : pointer;
@@ -114,19 +114,19 @@ function BeginThread(sa : Pointer;stacksize : dword;
 { to other OSes too ...                                        }
 { to other OSes too ...                                        }
 function BeginThread(ThreadFunction : tthreadfunc) : DWord;
 function BeginThread(ThreadFunction : tthreadfunc) : DWord;
 function BeginThread(ThreadFunction : tthreadfunc;p : pointer) : DWord;
 function BeginThread(ThreadFunction : tthreadfunc;p : pointer) : DWord;
-function BeginThread(ThreadFunction : tthreadfunc;p : pointer; var ThreadId : THandle) : DWord;
+function BeginThread(ThreadFunction : tthreadfunc;p : pointer; var ThreadId : TThreadID) : DWord;
 
 
 procedure EndThread(ExitCode : DWord);
 procedure EndThread(ExitCode : DWord);
 procedure EndThread;
 procedure EndThread;
 
 
 {some thread support functions}
 {some thread support functions}
-function  SuspendThread (threadHandle : dword) : dword;
-function  ResumeThread  (threadHandle : dword) : dword;
+function  SuspendThread (threadHandle : TThreadID) : dword;
+function  ResumeThread  (threadHandle : TThreadID) : dword;
 procedure ThreadSwitch;                                                                {give time to other threads}
 procedure ThreadSwitch;                                                                {give time to other threads}
-function  KillThread (threadHandle : dword) : dword;
-function  WaitForThreadTerminate (threadHandle : dword; TimeoutMs : longint) : dword;  {0=no timeout}
-function  ThreadSetPriority (threadHandle : dword; Prio: longint): boolean;            {-15..+15, 0=normal}
-function  ThreadGetPriority (threadHandle : dword): longint;
+function  KillThread (threadHandle : TThreadID) : dword;
+function  WaitForThreadTerminate (threadHandle : TThreadID; TimeoutMs : longint) : dword;  {0=no timeout}
+function  ThreadSetPriority (threadHandle : TThreadID; Prio: longint): boolean;            {-15..+15, 0=normal}
+function  ThreadGetPriority (threadHandle : TThreadID): longint;
 function  GetCurrentThreadId : dword;
 function  GetCurrentThreadId : dword;
 
 
 
 
@@ -155,7 +155,10 @@ procedure RTLeventsync(m:trtlmethod;p:tprocedure);
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.29  2005-04-09 17:26:08  florian
+  Revision 1.30  2005-04-13 20:10:50  florian
+    + TThreadID
+
+  Revision 1.29  2005/04/09 17:26:08  florian
     + classes.mainthreadid is set now
     + classes.mainthreadid is set now
     + rtleventresetevent
     + rtleventresetevent
     + rtleventwairfor with timeout
     + rtleventwairfor with timeout

+ 6 - 2
rtl/linux/sysosh.inc

@@ -20,7 +20,8 @@
 type
 type
   { fd are int in C also for 64bit targets (x86_64) }
   { fd are int in C also for 64bit targets (x86_64) }
   THandle = Longint;
   THandle = Longint;
-
+  TThreadID = THandle;
+  
   { pthread_mutex_t }
   { pthread_mutex_t }
   PRTLCriticalSection = ^TRTLCriticalSection;
   PRTLCriticalSection = ^TRTLCriticalSection;
   TRTLCriticalSection = record
   TRTLCriticalSection = record
@@ -37,7 +38,10 @@ type
 
 
 {
 {
    $Log$
    $Log$
-   Revision 1.2  2005-02-14 17:13:30  peter
+   Revision 1.3  2005-04-13 20:10:50  florian
+     + TThreadID
+
+   Revision 1.2  2005/02/14 17:13:30  peter
      * truncate log
      * truncate log
 
 
    Revision 1.1  2005/02/06 11:20:52  peter
    Revision 1.1  2005/02/06 11:20:52  peter

+ 6 - 2
rtl/macos/sysosh.inc

@@ -19,10 +19,11 @@
 {Platform specific information}
 {Platform specific information}
 type
 type
 {$ifdef CPU64}
 {$ifdef CPU64}
-  THandle = Int64;
+  THandle = Int64;  
 {$else CPU64}
 {$else CPU64}
   THandle = Longint;
   THandle = Longint;
 {$endif CPU64}
 {$endif CPU64}
+  TThreadID = THandle;
 
 
      PRTLCriticalSection = ^TRTLCriticalSection;
      PRTLCriticalSection = ^TRTLCriticalSection;
      TRTLCriticalSection = record
      TRTLCriticalSection = record
@@ -32,7 +33,10 @@ type
 
 
 {
 {
    $Log$
    $Log$
-   Revision 1.1  2005-02-07 21:30:12  peter
+   Revision 1.2  2005-04-13 20:10:50  florian
+     + TThreadID
+
+   Revision 1.1  2005/02/07 21:30:12  peter
      * system unit updated
      * system unit updated
 
 
    Revision 1.1  2005/02/06 16:57:18  peter
    Revision 1.1  2005/02/06 16:57:18  peter

+ 10 - 6
rtl/morphos/sysosh.inc

@@ -23,16 +23,20 @@ type
 {$else CPU64}
 {$else CPU64}
   THandle = Longint;
   THandle = Longint;
 {$endif CPU64}
 {$endif CPU64}
-
-     PRTLCriticalSection = ^TRTLCriticalSection;
-     TRTLCriticalSection = record
-       Locked: boolean
-     end;
+  TThreadID = THandle;
+  
+  PRTLCriticalSection = ^TRTLCriticalSection;
+  TRTLCriticalSection = record
+   Locked: boolean
+  end;
 
 
 
 
 {
 {
    $Log$
    $Log$
-   Revision 1.1  2005-02-07 21:30:12  peter
+   Revision 1.2  2005-04-13 20:10:50  florian
+     + TThreadID
+
+   Revision 1.1  2005/02/07 21:30:12  peter
      * system unit updated
      * system unit updated
 
 
    Revision 1.1  2005/02/06 16:57:18  peter
    Revision 1.1  2005/02/06 16:57:18  peter

+ 6 - 2
rtl/netware/sysosh.inc

@@ -19,7 +19,8 @@
 
 
 type
 type
   THandle = DWord;
   THandle = DWord;
-
+  TThreadID = THandle;
+  
    { the fields of this record are os dependent  }
    { the fields of this record are os dependent  }
    { and they shouldn't be used in a program     }
    { and they shouldn't be used in a program     }
    { only the type TCriticalSection is important }
    { only the type TCriticalSection is important }
@@ -42,7 +43,10 @@ const
 
 
 {
 {
    $Log$
    $Log$
-   Revision 1.1  2005-02-06 16:57:18  peter
+   Revision 1.2  2005-04-13 20:10:50  florian
+     + TThreadID
+
+   Revision 1.1  2005/02/06 16:57:18  peter
      * threads for go32v2,os,emx,netware
      * threads for go32v2,os,emx,netware
 
 
    Revision 1.1  2005/02/06 13:06:20  peter
    Revision 1.1  2005/02/06 13:06:20  peter

+ 12 - 8
rtl/netwlibc/sysosh.inc

@@ -17,17 +17,21 @@
  **********************************************************************}
  **********************************************************************}
 
 
 type
 type
-   THandle = DWord;
-
-   PRTLCriticalSection = ^TRTLCriticalSection;
-   TRTLCriticalSection = packed record
-        mutex : pointer;
-        reserved : array[0..52] of dword;
-     end;
+  THandle = DWord;
+  TThreadID = THandle;
+  
+  PRTLCriticalSection = ^TRTLCriticalSection;
+  TRTLCriticalSection = packed record
+      mutex : pointer;
+      reserved : array[0..52] of dword;
+   end;
 
 
 {
 {
    $Log$
    $Log$
-   Revision 1.2  2005-02-14 17:13:30  peter
+   Revision 1.3  2005-04-13 20:10:50  florian
+     + TThreadID
+
+   Revision 1.2  2005/02/14 17:13:30  peter
      * truncate log
      * truncate log
 
 
    Revision 1.1  2005/02/06 16:57:18  peter
    Revision 1.1  2005/02/06 16:57:18  peter

+ 18 - 14
rtl/os2/sysosh.inc

@@ -19,24 +19,28 @@
 {Platform specific information}
 {Platform specific information}
 type
 type
   THandle = Longint;
   THandle = Longint;
-
-    { the fields of this record are os dependent  }
-    { and they shouldn't be used in a program     }
-    { only the type TCriticalSection is important }
-    PRTLCriticalSection = ^TRTLCriticalSection;
-    TRTLCriticalSection = packed record
-      DebugInfo : pointer;
-      LockCount : longint;
-      RecursionCount : longint;
-      OwningThread : DWord;
-      LockSemaphore : DWord;
-      Reserved : DWord;
-    end;
+  TThreadID = THandle;
+  
+  { the fields of this record are os dependent  }
+  { and they shouldn't be used in a program     }
+  { only the type TCriticalSection is important }
+  PRTLCriticalSection = ^TRTLCriticalSection;
+  TRTLCriticalSection = packed record
+    DebugInfo : pointer;
+    LockCount : longint;
+    RecursionCount : longint;
+    OwningThread : DWord;
+    LockSemaphore : DWord;
+    Reserved : DWord;
+  end;
 
 
 
 
 {
 {
    $Log$
    $Log$
-   Revision 1.1  2005-02-06 16:57:18  peter
+   Revision 1.2  2005-04-13 20:10:50  florian
+     + TThreadID
+
+   Revision 1.1  2005/02/06 16:57:18  peter
      * threads for go32v2,os,emx,netware
      * threads for go32v2,os,emx,netware
 
 
    Revision 1.1  2005/02/06 13:06:20  peter
    Revision 1.1  2005/02/06 13:06:20  peter

+ 11 - 7
rtl/solaris/sysosh.inc

@@ -18,16 +18,20 @@
 
 
 type
 type
   THandle = Longint;
   THandle = Longint;
-
-     PRTLCriticalSection = ^TRTLCriticalSection;
-     TRTLCriticalSection = record
-     {$warning TODO TRTLCriticalSection}
-       Locked: boolean
-     end;
+  TThreadID = THandle;
+  
+  PRTLCriticalSection = ^TRTLCriticalSection;
+  TRTLCriticalSection = record
+  {$warning TODO TRTLCriticalSection}
+   Locked: boolean
+  end;
 
 
 {
 {
    $Log$
    $Log$
-   Revision 1.1  2005-02-10 17:30:54  peter
+   Revision 1.2  2005-04-13 20:10:50  florian
+     + TThreadID
+
+   Revision 1.1  2005/02/10 17:30:54  peter
      * renamed to solaris
      * renamed to solaris
 
 
    Revision 1.1  2005/02/07 22:17:26  peter
    Revision 1.1  2005/02/07 22:17:26  peter

+ 61 - 57
rtl/unix/cthreads.pp

@@ -197,90 +197,91 @@ Type  PINTRTLEvent = ^TINTRTLEvent;
       end;
       end;
 
 
 
 
-    function CBeginThread(sa : Pointer;stacksize : dword;
-                         ThreadFunction : tthreadfunc;p : pointer;
-                         creationFlags : dword; var ThreadId : THandle) : DWord;
-      var
-        ti : pthreadinfo;
-        thread_attr : pthread_attr_t;
-      begin
+  function CBeginThread(sa : Pointer;stacksize : dword;
+                       ThreadFunction : tthreadfunc;p : pointer;
+                       creationFlags : dword; var ThreadId : THandle) : DWord;
+    var
+      ti : pthreadinfo;
+      thread_attr : pthread_attr_t;
+    begin
 {$ifdef DEBUG_MT}
 {$ifdef DEBUG_MT}
-        writeln('Creating new thread');
+      writeln('Creating new thread');
 {$endif DEBUG_MT}
 {$endif DEBUG_MT}
-        { Initialize multithreading if not done }
-        if not IsMultiThread then
-         begin
+      { Initialize multithreading if not done }
+      if not IsMultiThread then
+       begin
 {$ifdef HASTHREADVAR}
 {$ifdef HASTHREADVAR}
-          { We're still running in single thread mode, setup the TLS }
-           pthread_key_create(@TLSKey,nil);
-           InitThreadVars(@CRelocateThreadvar);
+        { We're still running in single thread mode, setup the TLS }
+         pthread_key_create(@TLSKey,nil);
+         InitThreadVars(@CRelocateThreadvar);
 {$endif HASTHREADVAR}
 {$endif HASTHREADVAR}
-           IsMultiThread:=true;
-         end;
-        { the only way to pass data to the newly created thread
-          in a MT safe way, is to use the heap }
-        new(ti);
-        ti^.f:=ThreadFunction;
-        ti^.p:=p;
-        ti^.stklen:=stacksize;
-        { call pthread_create }
+         IsMultiThread:=true;
+       end;
+      { the only way to pass data to the newly created thread
+        in a MT safe way, is to use the heap }
+      new(ti);
+      ti^.f:=ThreadFunction;
+      ti^.p:=p;
+      ti^.stklen:=stacksize;
+      { call pthread_create }
 {$ifdef DEBUG_MT}
 {$ifdef DEBUG_MT}
-        writeln('Starting new thread');
+      writeln('Starting new thread');
 {$endif DEBUG_MT}
 {$endif DEBUG_MT}
-        pthread_attr_init(@thread_attr);
-        pthread_attr_setinheritsched(@thread_attr, PTHREAD_EXPLICIT_SCHED);
+      pthread_attr_init(@thread_attr);
+      pthread_attr_setinheritsched(@thread_attr, PTHREAD_EXPLICIT_SCHED);
 
 
-        // will fail under linux -- apparently unimplemented
-        pthread_attr_setscope(@thread_attr, PTHREAD_SCOPE_PROCESS);
+      // will fail under linux -- apparently unimplemented
+      pthread_attr_setscope(@thread_attr, PTHREAD_SCOPE_PROCESS);
 
 
-        // don't create detached, we need to be able to join (waitfor) on
-        // the newly created thread!
-        //pthread_attr_setdetachstate(@thread_attr, PTHREAD_CREATE_DETACHED);
-        if pthread_create(@threadid, @thread_attr, @ThreadMain,ti) <> 0 then begin
-          threadid := 0;
-        end;
-        CBeginThread:=threadid;
+      // don't create detached, we need to be able to join (waitfor) on
+      // the newly created thread!
+      //pthread_attr_setdetachstate(@thread_attr, PTHREAD_CREATE_DETACHED);
+      if pthread_create(@threadid, @thread_attr, @ThreadMain,ti) <> 0 then begin
+        threadid := 0;
+      end;
+      CBeginThread:=threadid;
 {$ifdef DEBUG_MT}
 {$ifdef DEBUG_MT}
-        writeln('BeginThread returning ',CBeginThread);
+      writeln('BeginThread returning ',CBeginThread);
 {$endif DEBUG_MT}
 {$endif DEBUG_MT}
-      end;
+    end;
 
 
 
 
-    procedure CEndThread(ExitCode : DWord);
-      begin
-        DoneThread;
-        pthread_detach(pthread_t(pthread_self()));
-        pthread_exit(pointer(ptrint(ExitCode)));
-      end;
+  procedure CEndThread(ExitCode : DWord);
+    begin
+      DoneThread;
+      pthread_detach(pthread_t(pthread_self()));
+      pthread_exit(pointer(ptrint(ExitCode)));
+    end;
 
 
 
 
-{$warning threadhandle can be larger than a dword}
-    function  CSuspendThread (threadHandle : dword) : dword;
+
+  function  CSuspendThread (threadHandle : TThreadID) : dword;
     begin
     begin
       {$Warning SuspendThread needs to be implemented}
       {$Warning SuspendThread needs to be implemented}
     end;
     end;
 
 
-{$warning threadhandle can be larger than a dword}
-    function  CResumeThread  (threadHandle : dword) : dword;
+
+  function  CResumeThread  (threadHandle : TThreadID) : dword;
     begin
     begin
       {$Warning ResumeThread needs to be implemented}
       {$Warning ResumeThread needs to be implemented}
     end;
     end;
 
 
-    procedure CThreadSwitch;  {give time to other threads}
+
+  procedure CThreadSwitch;  {give time to other threads}
     begin
     begin
       {extern int pthread_yield (void) __THROW;}
       {extern int pthread_yield (void) __THROW;}
       {$Warning ThreadSwitch needs to be implemented}
       {$Warning ThreadSwitch needs to be implemented}
     end;
     end;
 
 
-{$warning threadhandle can be larger than a dword}
-    function  CKillThread (threadHandle : dword) : dword;
+
+  function  CKillThread (threadHandle : TThreadID) : dword;
     begin
     begin
       pthread_detach(pthread_t(threadHandle));
       pthread_detach(pthread_t(threadHandle));
       CKillThread := pthread_cancel(pthread_t(threadHandle));
       CKillThread := pthread_cancel(pthread_t(threadHandle));
     end;
     end;
 
 
-{$warning threadhandle can be larger than a dword}
-    function  CWaitForThreadTerminate (threadHandle : dword; TimeoutMs : longint) : dword;  {0=no timeout}
+
+  function  CWaitForThreadTerminate (threadHandle : TThreadID; TimeoutMs : longint) : dword;  {0=no timeout}
     var
     var
       LResultP: Pointer;
       LResultP: Pointer;
       LResult: DWord;
       LResult: DWord;
@@ -292,20 +293,20 @@ Type  PINTRTLEvent = ^TINTRTLEvent;
     end;
     end;
 
 
 {$warning threadhandle can be larger than a dword}
 {$warning threadhandle can be larger than a dword}
-    function  CThreadSetPriority (threadHandle : dword; Prio: longint): boolean; {-15..+15, 0=normal}
+    function  CThreadSetPriority (threadHandle : TThreadID; Prio: longint): boolean; {-15..+15, 0=normal}
     begin
     begin
       {$Warning ThreadSetPriority needs to be implemented}
       {$Warning ThreadSetPriority needs to be implemented}
     end;
     end;
 
 
 
 
 {$warning threadhandle can be larger than a dword}
 {$warning threadhandle can be larger than a dword}
-    function  CThreadGetPriority (threadHandle : dword): Integer;
+  function  CThreadGetPriority (threadHandle : TThreadID): Integer;
     begin
     begin
       {$Warning ThreadGetPriority needs to be implemented}
       {$Warning ThreadGetPriority needs to be implemented}
     end;
     end;
+    
 
 
-{$warning threadhandle can be larger than a dword}
-    function  CGetCurrentThreadId : dword;
+  function  CGetCurrentThreadId : TThreadID;
     begin
     begin
       CGetCurrentThreadId:=dword(pthread_self());
       CGetCurrentThreadId:=dword(pthread_self());
     end;
     end;
@@ -659,7 +660,10 @@ finalization
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.27  2005-04-09 18:45:43  florian
+  Revision 1.28  2005-04-13 20:10:50  florian
+    + TThreadID
+
+  Revision 1.27  2005/04/09 18:45:43  florian
     * fixed some unix stuff
     * fixed some unix stuff
 
 
   Revision 1.26  2005/04/09 17:26:08  florian
   Revision 1.26  2005/04/09 17:26:08  florian

+ 6 - 2
rtl/watcom/system.pp

@@ -34,7 +34,8 @@ INTERFACE
 {Platform specific information}
 {Platform specific information}
 type
 type
   THandle = Longint;
   THandle = Longint;
-
+  TThreadID = THandle;
+  
 const
 const
  LineEnding = #13#10;
  LineEnding = #13#10;
 { LFNSupport is a variable here, defined below!!! }
 { LFNSupport is a variable here, defined below!!! }
@@ -1540,7 +1541,10 @@ End.
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.21  2005-04-03 21:10:59  hajny
+  Revision 1.22  2005-04-13 20:10:50  florian
+    + TThreadID
+
+  Revision 1.21  2005/04/03 21:10:59  hajny
     * EOF_CTRLZ conditional define replaced with CtrlZMarksEOF, #26 handling made more consistent (fix for bug 2453)
     * EOF_CTRLZ conditional define replaced with CtrlZMarksEOF, #26 handling made more consistent (fix for bug 2453)
 
 
   Revision 1.20  2005/02/14 17:13:32  peter
   Revision 1.20  2005/02/14 17:13:32  peter

+ 18 - 14
rtl/win32/sysosh.inc

@@ -23,23 +23,27 @@ type
 {$else CPU64}
 {$else CPU64}
   THandle = DWord;
   THandle = DWord;
 {$endif CPU64}
 {$endif CPU64}
-
-    { the fields of this record are os dependent  }
-    { and they shouldn't be used in a program     }
-    { only the type TCriticalSection is important }
-    PRTLCriticalSection = ^TRTLCriticalSection;
-    TRTLCriticalSection = packed record
-      DebugInfo : pointer;
-      LockCount : longint;
-      RecursionCount : longint;
-      OwningThread : DWord;
-      LockSemaphore : DWord;
-      Reserved : DWord;
-    end;
+  TThreadID = THandle;
+  
+  { the fields of this record are os dependent  }
+  { and they shouldn't be used in a program     }
+  { only the type TCriticalSection is important }
+  PRTLCriticalSection = ^TRTLCriticalSection;
+  TRTLCriticalSection = packed record
+    DebugInfo : pointer;
+    LockCount : longint;
+    RecursionCount : longint;
+    OwningThread : DWord;
+    LockSemaphore : DWord;
+    Reserved : DWord;
+  end;
 
 
 {
 {
    $Log$
    $Log$
-   Revision 1.2  2005-02-14 17:13:32  peter
+   Revision 1.3  2005-04-13 20:10:50  florian
+     + TThreadID
+
+   Revision 1.2  2005/02/14 17:13:32  peter
      * truncate log
      * truncate log
 
 
    Revision 1.1  2005/02/06 13:06:20  peter
    Revision 1.1  2005/02/06 13:06:20  peter