+ TThreadID

This commit is contained in:
florian 2005-04-13 20:10:50 +00:00
parent 36faaa39b0
commit 4aa4aeae79
15 changed files with 214 additions and 154 deletions

View File

@ -28,6 +28,7 @@ interface
type
THandle = longint;
TThreadID = THandle;
{ include heap support headers }
@ -547,7 +548,10 @@ begin
end.
{
$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)
Revision 1.21 2005/02/14 17:13:21 peter

View File

@ -20,6 +20,7 @@
type
{ fd are int in C also for 64bit targets (x86_64) }
THandle = Longint;
TThreadID = THandle;
{ pthread_mutex_t }
PRTLCriticalSection = ^TRTLCriticalSection;
@ -37,7 +38,10 @@ type
{
$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
Revision 1.1 2005/02/06 12:16:52 peter

View File

@ -20,6 +20,8 @@
type
THandle = Longint;
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 }
@ -36,7 +38,10 @@ type
{
$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
Revision 1.1 2005/02/06 13:06:20 peter

View File

@ -19,6 +19,7 @@
{Platform specific information}
type
THandle = Longint;
TThreadID = THandle;
PRTLCriticalSection = ^TRTLCriticalSection;
TRTLCriticalSection = record
@ -28,7 +29,10 @@ type
{
$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
Revision 1.1 2005/02/06 13:06:20 peter

View File

@ -3,7 +3,7 @@
This file is part of the Free Pascal Run time library.
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
See the File COPYING.FPC, included in this distribution,
@ -26,15 +26,15 @@ type
trtlmethod = procedure of object;
// 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);
// Used for Suspend/Resume/Kill
TThreadHandler = Function (threadHandle : dword) : dword;
TThreadHandler = Function (threadHandle : TThreadID) : dword;
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);
TInitThreadVarHandler = Procedure(var offset : dword;size : dword);
TRelocateThreadVarHandler = Function(offset : dword) : pointer;
@ -114,19 +114,19 @@ function BeginThread(sa : Pointer;stacksize : dword;
{ to other OSes too ... }
function BeginThread(ThreadFunction : tthreadfunc) : 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;
{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}
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;
@ -155,7 +155,10 @@ procedure RTLeventsync(m:trtlmethod;p:tprocedure);
{
$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
+ rtleventresetevent
+ rtleventwairfor with timeout

View File

@ -20,6 +20,7 @@
type
{ fd are int in C also for 64bit targets (x86_64) }
THandle = Longint;
TThreadID = THandle;
{ pthread_mutex_t }
PRTLCriticalSection = ^TRTLCriticalSection;
@ -37,7 +38,10 @@ type
{
$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
Revision 1.1 2005/02/06 11:20:52 peter

View File

@ -23,6 +23,7 @@ type
{$else CPU64}
THandle = Longint;
{$endif CPU64}
TThreadID = THandle;
PRTLCriticalSection = ^TRTLCriticalSection;
TRTLCriticalSection = record
@ -32,7 +33,10 @@ type
{
$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
Revision 1.1 2005/02/06 16:57:18 peter

View File

@ -23,6 +23,7 @@ type
{$else CPU64}
THandle = Longint;
{$endif CPU64}
TThreadID = THandle;
PRTLCriticalSection = ^TRTLCriticalSection;
TRTLCriticalSection = record
@ -32,7 +33,10 @@ type
{
$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
Revision 1.1 2005/02/06 16:57:18 peter

View File

@ -19,6 +19,7 @@
type
THandle = DWord;
TThreadID = THandle;
{ the fields of this record are os dependent }
{ and they shouldn't be used in a program }
@ -42,7 +43,10 @@ const
{
$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
Revision 1.1 2005/02/06 13:06:20 peter

View File

@ -18,6 +18,7 @@
type
THandle = DWord;
TThreadID = THandle;
PRTLCriticalSection = ^TRTLCriticalSection;
TRTLCriticalSection = packed record
@ -27,7 +28,10 @@ type
{
$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
Revision 1.1 2005/02/06 16:57:18 peter

View File

@ -19,6 +19,7 @@
{Platform specific information}
type
THandle = Longint;
TThreadID = THandle;
{ the fields of this record are os dependent }
{ and they shouldn't be used in a program }
@ -36,7 +37,10 @@ type
{
$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
Revision 1.1 2005/02/06 13:06:20 peter

View File

@ -18,6 +18,7 @@
type
THandle = Longint;
TThreadID = THandle;
PRTLCriticalSection = ^TRTLCriticalSection;
TRTLCriticalSection = record
@ -27,7 +28,10 @@ type
{
$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
Revision 1.1 2005/02/07 22:17:26 peter

View File

@ -254,33 +254,34 @@ Type PINTRTLEvent = ^TINTRTLEvent;
end;
{$warning threadhandle can be larger than a dword}
function CSuspendThread (threadHandle : dword) : dword;
function CSuspendThread (threadHandle : TThreadID) : dword;
begin
{$Warning SuspendThread needs to be implemented}
end;
{$warning threadhandle can be larger than a dword}
function CResumeThread (threadHandle : dword) : dword;
function CResumeThread (threadHandle : TThreadID) : dword;
begin
{$Warning ResumeThread needs to be implemented}
end;
procedure CThreadSwitch; {give time to other threads}
begin
{extern int pthread_yield (void) __THROW;}
{$Warning ThreadSwitch needs to be implemented}
end;
{$warning threadhandle can be larger than a dword}
function CKillThread (threadHandle : dword) : dword;
function CKillThread (threadHandle : TThreadID) : dword;
begin
pthread_detach(pthread_t(threadHandle));
CKillThread := pthread_cancel(pthread_t(threadHandle));
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
LResultP: Pointer;
LResult: DWord;
@ -292,20 +293,20 @@ Type PINTRTLEvent = ^TINTRTLEvent;
end;
{$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
{$Warning ThreadSetPriority needs to be implemented}
end;
{$warning threadhandle can be larger than a dword}
function CThreadGetPriority (threadHandle : dword): Integer;
function CThreadGetPriority (threadHandle : TThreadID): Integer;
begin
{$Warning ThreadGetPriority needs to be implemented}
end;
{$warning threadhandle can be larger than a dword}
function CGetCurrentThreadId : dword;
function CGetCurrentThreadId : TThreadID;
begin
CGetCurrentThreadId:=dword(pthread_self());
end;
@ -659,7 +660,10 @@ finalization
end.
{
$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
Revision 1.26 2005/04/09 17:26:08 florian

View File

@ -34,6 +34,7 @@ INTERFACE
{Platform specific information}
type
THandle = Longint;
TThreadID = THandle;
const
LineEnding = #13#10;
@ -1540,7 +1541,10 @@ End.
{
$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)
Revision 1.20 2005/02/14 17:13:32 peter

View File

@ -23,6 +23,7 @@ type
{$else CPU64}
THandle = DWord;
{$endif CPU64}
TThreadID = THandle;
{ the fields of this record are os dependent }
{ and they shouldn't be used in a program }
@ -39,7 +40,10 @@ type
{
$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
Revision 1.1 2005/02/06 13:06:20 peter