mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-12-04 16:27:17 +01:00
+ Removed HASTHREADVAR SUPPORT_THREADVAR defines
git-svn-id: trunk@295 -
This commit is contained in:
parent
a775d3d487
commit
859bb30daa
@ -101,11 +101,7 @@ const
|
|||||||
function GetEnvPChar (EnvVar: string): PChar;
|
function GetEnvPChar (EnvVar: string): PChar;
|
||||||
|
|
||||||
|
|
||||||
{$ifdef HASTHREADVAR}
|
|
||||||
threadvar
|
threadvar
|
||||||
{$else HASTHREADVAR}
|
|
||||||
var
|
|
||||||
{$endif HASTHREADVAR}
|
|
||||||
(* For compatibility with VP/2, used for runflags in Exec procedure. *)
|
(* For compatibility with VP/2, used for runflags in Exec procedure. *)
|
||||||
ExecFlags: cardinal;
|
ExecFlags: cardinal;
|
||||||
|
|
||||||
@ -126,11 +122,7 @@ const
|
|||||||
{$I dos.inc}
|
{$I dos.inc}
|
||||||
|
|
||||||
|
|
||||||
{$ifdef HASTHREADVAR}
|
|
||||||
threadvar
|
threadvar
|
||||||
{$else HASTHREADVAR}
|
|
||||||
var
|
|
||||||
{$endif HASTHREADVAR}
|
|
||||||
LastSR: SearchRec;
|
LastSR: SearchRec;
|
||||||
|
|
||||||
var
|
var
|
||||||
|
|||||||
@ -416,11 +416,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
{$ifdef HASTHREADVAR}
|
|
||||||
threadvar
|
threadvar
|
||||||
{$else HASTHREADVAR}
|
|
||||||
var
|
|
||||||
{$endif HASTHREADVAR}
|
|
||||||
DefaultCreator: ShortString;
|
DefaultCreator: ShortString;
|
||||||
DefaultFileType: ShortString;
|
DefaultFileType: ShortString;
|
||||||
|
|
||||||
|
|||||||
@ -74,7 +74,6 @@ function DosExitCritSec:cardinal; cdecl; external 'DOSCALLS' index 233;
|
|||||||
Threadvar support
|
Threadvar support
|
||||||
*****************************************************************************}
|
*****************************************************************************}
|
||||||
|
|
||||||
{$ifdef HASTHREADVAR}
|
|
||||||
const
|
const
|
||||||
ThreadVarBlockSize: dword = 0;
|
ThreadVarBlockSize: dword = 0;
|
||||||
|
|
||||||
@ -128,7 +127,6 @@ end;
|
|||||||
fpc_threadvar_relocate_proc := @SysRelocateThreadvar;
|
fpc_threadvar_relocate_proc := @SysRelocateThreadvar;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{$endif HASTHREADVAR}
|
|
||||||
|
|
||||||
|
|
||||||
{*****************************************************************************
|
{*****************************************************************************
|
||||||
|
|||||||
@ -196,11 +196,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
{$ifdef HASTHREADVAR}
|
|
||||||
threadvar
|
threadvar
|
||||||
{$else HASTHREADVAR}
|
|
||||||
var
|
|
||||||
{$endif HASTHREADVAR}
|
|
||||||
CurrX, CurrY: dword;
|
CurrX, CurrY: dword;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -21,11 +21,7 @@ const
|
|||||||
ExtensionSeparator = '.';
|
ExtensionSeparator = '.';
|
||||||
|
|
||||||
{$IFNDEF HAS_DOSEXITCODE}
|
{$IFNDEF HAS_DOSEXITCODE}
|
||||||
{$IFDEF HASTHREADVAR}
|
|
||||||
threadvar
|
threadvar
|
||||||
{$ELSE HASTHREADVAR}
|
|
||||||
var
|
|
||||||
{$ENDIF HASTHREADVAR}
|
|
||||||
LastDosExitCode: longint;
|
LastDosExitCode: longint;
|
||||||
|
|
||||||
function DosExitCode: word;
|
function DosExitCode: word;
|
||||||
|
|||||||
@ -81,11 +81,7 @@ Type
|
|||||||
Sec : word;
|
Sec : word;
|
||||||
End;
|
End;
|
||||||
|
|
||||||
{$ifdef HASTHREADVAR}
|
|
||||||
threadvar
|
threadvar
|
||||||
{$else HASTHREADVAR}
|
|
||||||
var
|
|
||||||
{$endif HASTHREADVAR}
|
|
||||||
DosError : integer;
|
DosError : integer;
|
||||||
|
|
||||||
{$ifdef cpui386}
|
{$ifdef cpui386}
|
||||||
|
|||||||
@ -37,11 +37,8 @@ Type
|
|||||||
|
|
||||||
Const
|
Const
|
||||||
CatchAllExceptions : PtrInt = -1;
|
CatchAllExceptions : PtrInt = -1;
|
||||||
{$ifdef SUPPORT_THREADVAR}
|
|
||||||
ThreadVar
|
ThreadVar
|
||||||
{$else SUPPORT_THREADVAR}
|
|
||||||
Var
|
|
||||||
{$endif SUPPORT_THREADVAR}
|
|
||||||
ExceptAddrStack : PExceptAddr;
|
ExceptAddrStack : PExceptAddr;
|
||||||
ExceptObjectStack : PExceptObject;
|
ExceptObjectStack : PExceptObject;
|
||||||
|
|
||||||
|
|||||||
@ -28,9 +28,6 @@
|
|||||||
{$endif}
|
{$endif}
|
||||||
|
|
||||||
{ Use threadvars when the compiler supports it }
|
{ Use threadvars when the compiler supports it }
|
||||||
{$ifdef HASTHREADVAR}
|
|
||||||
{$define SUPPORT_THREADVAR}
|
|
||||||
{$endif HASTHREADVAR}
|
|
||||||
|
|
||||||
{ don't use FPU registervariables on the i386 }
|
{ don't use FPU registervariables on the i386 }
|
||||||
{$ifdef CPUI386}
|
{$ifdef CPUI386}
|
||||||
@ -352,11 +349,7 @@ var
|
|||||||
{ Threading support }
|
{ Threading support }
|
||||||
fpc_threadvar_relocate_proc : pointer; public name 'FPC_THREADVAR_RELOCATE';
|
fpc_threadvar_relocate_proc : pointer; public name 'FPC_THREADVAR_RELOCATE';
|
||||||
|
|
||||||
{$ifdef SUPPORT_THREADVAR}
|
|
||||||
ThreadVar
|
ThreadVar
|
||||||
{$else SUPPORT_THREADVAR}
|
|
||||||
Var
|
|
||||||
{$endif SUPPORT_THREADVAR}
|
|
||||||
ThreadID : TThreadID;
|
ThreadID : TThreadID;
|
||||||
{ Standard In- and Output }
|
{ Standard In- and Output }
|
||||||
ErrOutput,
|
ErrOutput,
|
||||||
|
|||||||
@ -96,9 +96,7 @@ Function SetThreadManager(Const NewTM : TThreadManager) : Boolean;
|
|||||||
Procedure SetNoThreadManager;
|
Procedure SetNoThreadManager;
|
||||||
{$endif DISABLE_NO_THREAD_MANAGER}
|
{$endif DISABLE_NO_THREAD_MANAGER}
|
||||||
// Needs to be exported, so the manager can call it.
|
// Needs to be exported, so the manager can call it.
|
||||||
{$ifdef HASTHREADVAR}
|
|
||||||
procedure InitThreadVars(RelocProc : Pointer);
|
procedure InitThreadVars(RelocProc : Pointer);
|
||||||
{$endif HASTHREADVAR}
|
|
||||||
procedure InitThread(stklen:cardinal);
|
procedure InitThread(stklen:cardinal);
|
||||||
|
|
||||||
{*****************************************************************************
|
{*****************************************************************************
|
||||||
|
|||||||
@ -19,7 +19,6 @@
|
|||||||
Threadvar support
|
Threadvar support
|
||||||
*****************************************************************************}
|
*****************************************************************************}
|
||||||
|
|
||||||
{$ifdef HASTHREADVAR}
|
|
||||||
|
|
||||||
type
|
type
|
||||||
pltvInitEntry = ^ltvInitEntry;
|
pltvInitEntry = ^ltvInitEntry;
|
||||||
@ -97,5 +96,4 @@ begin
|
|||||||
fpc_threadvar_relocate_proc:=RelocProc;
|
fpc_threadvar_relocate_proc:=RelocProc;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{$endif HASTHREADVAR}
|
|
||||||
|
|
||||||
|
|||||||
@ -31,7 +31,6 @@
|
|||||||
Threadvar support
|
Threadvar support
|
||||||
*****************************************************************************}
|
*****************************************************************************}
|
||||||
|
|
||||||
{$ifdef HASTHREADVAR}
|
|
||||||
|
|
||||||
const
|
const
|
||||||
threadvarblocksize : dword = 0; // total size of allocated threadvars
|
threadvarblocksize : dword = 0; // total size of allocated threadvars
|
||||||
@ -106,7 +105,6 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{$endif HASTHREADVAR}
|
|
||||||
|
|
||||||
|
|
||||||
{*****************************************************************************
|
{*****************************************************************************
|
||||||
@ -127,9 +125,7 @@ procedure DoneThread;
|
|||||||
|
|
||||||
begin
|
begin
|
||||||
{ release thread vars }
|
{ release thread vars }
|
||||||
{$ifdef HASTHREADVAR}
|
|
||||||
SysReleaseThreadVars;
|
SysReleaseThreadVars;
|
||||||
{$endif}
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
@ -139,11 +135,9 @@ function ThreadMain(param : pointer) : dword; cdecl;
|
|||||||
ti : tthreadinfo;
|
ti : tthreadinfo;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
{$ifdef HASTHREADVAR}
|
|
||||||
{ Allocate local thread vars, this must be the first thing,
|
{ Allocate local thread vars, this must be the first thing,
|
||||||
because the exception management and io depends on threadvars }
|
because the exception management and io depends on threadvars }
|
||||||
SysAllocateThreadVars;
|
SysAllocateThreadVars;
|
||||||
{$endif HASTHREADVAR}
|
|
||||||
{$ifdef DEBUG_MT}
|
{$ifdef DEBUG_MT}
|
||||||
ConsolePrintf(#13'New thread %x started, initialising ...'#13#10,_GetThreadID);
|
ConsolePrintf(#13'New thread %x started, initialising ...'#13#10,_GetThreadID);
|
||||||
{$endif DEBUG_MT}
|
{$endif DEBUG_MT}
|
||||||
@ -167,13 +161,11 @@ function SysBeginThread(sa : Pointer;stacksize : dword;
|
|||||||
{$ifdef DEBUG_MT}
|
{$ifdef DEBUG_MT}
|
||||||
ConsolePrintf(#13'Creating new thread'#13#10);
|
ConsolePrintf(#13'Creating new thread'#13#10);
|
||||||
{$endif DEBUG_MT}
|
{$endif DEBUG_MT}
|
||||||
{$ifdef HASTHREADVAR}
|
|
||||||
if not IsMultiThread then
|
if not IsMultiThread then
|
||||||
begin
|
begin
|
||||||
InitThreadVars(@SysRelocateThreadvar);
|
InitThreadVars(@SysRelocateThreadvar);
|
||||||
IsMultithread:=true;
|
IsMultithread:=true;
|
||||||
end;
|
end;
|
||||||
{$endif}
|
|
||||||
{ the only way to pass data to the newly created thread }
|
{ the only way to pass data to the newly created thread }
|
||||||
{ in a MT safe way, is to use the heap }
|
{ in a MT safe way, is to use the heap }
|
||||||
new(ti);
|
new(ti);
|
||||||
@ -472,12 +464,10 @@ begin
|
|||||||
DoneCriticalSection :=@SysDoneCriticalSection;
|
DoneCriticalSection :=@SysDoneCriticalSection;
|
||||||
EnterCriticalSection :=@SysEnterCriticalSection;
|
EnterCriticalSection :=@SysEnterCriticalSection;
|
||||||
LeaveCriticalSection :=@SysLeaveCriticalSection;
|
LeaveCriticalSection :=@SysLeaveCriticalSection;
|
||||||
{$ifdef HASTHREADVAR}
|
|
||||||
InitThreadVar :=@SysInitThreadVar;
|
InitThreadVar :=@SysInitThreadVar;
|
||||||
RelocateThreadVar :=@SysRelocateThreadVar;
|
RelocateThreadVar :=@SysRelocateThreadVar;
|
||||||
AllocateThreadVars :=@SysAllocateThreadVars;
|
AllocateThreadVars :=@SysAllocateThreadVars;
|
||||||
ReleaseThreadVars :=@SysReleaseThreadVars;
|
ReleaseThreadVars :=@SysReleaseThreadVars;
|
||||||
{$endif HASTHREADVAR}
|
|
||||||
BasicEventCreate :=@NoBasicEventCreate;
|
BasicEventCreate :=@NoBasicEventCreate;
|
||||||
basiceventdestroy :=@Nobasiceventdestroy;
|
basiceventdestroy :=@Nobasiceventdestroy;
|
||||||
basiceventResetEvent :=@NobasiceventResetEvent;
|
basiceventResetEvent :=@NobasiceventResetEvent;
|
||||||
|
|||||||
@ -27,7 +27,6 @@
|
|||||||
Threadvar support
|
Threadvar support
|
||||||
*****************************************************************************}
|
*****************************************************************************}
|
||||||
|
|
||||||
{$ifdef HASTHREADVAR}
|
|
||||||
const
|
const
|
||||||
threadvarblocksize : dword = 0;
|
threadvarblocksize : dword = 0;
|
||||||
thredvarsmainthread: pointer = nil; // to free the threadvars in the signal handler
|
thredvarsmainthread: pointer = nil; // to free the threadvars in the signal handler
|
||||||
@ -82,7 +81,6 @@
|
|||||||
pthread_setspecific(tlskey,newPtr);
|
pthread_setspecific(tlskey,newPtr);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{$endif HASTHREADVAR}
|
|
||||||
|
|
||||||
|
|
||||||
{*****************************************************************************
|
{*****************************************************************************
|
||||||
@ -100,10 +98,8 @@
|
|||||||
procedure DoneThread;
|
procedure DoneThread;
|
||||||
begin
|
begin
|
||||||
{ Release Threadvars }
|
{ Release Threadvars }
|
||||||
{$ifdef HASTHREADVAR}
|
|
||||||
WRITE_DEBUG('DoneThread, releasing threadvars'#13#10);
|
WRITE_DEBUG('DoneThread, releasing threadvars'#13#10);
|
||||||
SysReleaseThreadVars;
|
SysReleaseThreadVars;
|
||||||
{$endif HASTHREADVAR}
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
@ -112,11 +108,9 @@
|
|||||||
ti : tthreadinfo;
|
ti : tthreadinfo;
|
||||||
begin
|
begin
|
||||||
WRITE_DEBUG('New thread started, initing threadvars'#13#10);
|
WRITE_DEBUG('New thread started, initing threadvars'#13#10);
|
||||||
{$ifdef HASTHREADVAR}
|
|
||||||
{ Allocate local thread vars, this must be the first thing,
|
{ Allocate local thread vars, this must be the first thing,
|
||||||
because the exception management and io depends on threadvars }
|
because the exception management and io depends on threadvars }
|
||||||
SysAllocateThreadVars;
|
SysAllocateThreadVars;
|
||||||
{$endif HASTHREADVAR}
|
|
||||||
{ Copy parameter to local data }
|
{ Copy parameter to local data }
|
||||||
WRITE_DEBUG('New thread started, initialising ...'#13#10);
|
WRITE_DEBUG('New thread started, initialising ...'#13#10);
|
||||||
ti:=pthreadinfo(param)^;
|
ti:=pthreadinfo(param)^;
|
||||||
@ -143,11 +137,9 @@
|
|||||||
{ Initialize multithreading if not done }
|
{ Initialize multithreading if not done }
|
||||||
if not IsMultiThread then
|
if not IsMultiThread then
|
||||||
begin
|
begin
|
||||||
{$ifdef HASTHREADVAR}
|
|
||||||
{ We're still running in single thread mode, setup the TLS }
|
{ We're still running in single thread mode, setup the TLS }
|
||||||
pthread_key_create(@TLSKey,nil);
|
pthread_key_create(@TLSKey,nil);
|
||||||
InitThreadVars(@SysRelocateThreadvar);
|
InitThreadVars(@SysRelocateThreadvar);
|
||||||
{$endif HASTHREADVAR}
|
|
||||||
IsMultiThread:=true;
|
IsMultiThread:=true;
|
||||||
end;
|
end;
|
||||||
{ the only way to pass data to the newly created thread
|
{ the only way to pass data to the newly created thread
|
||||||
@ -423,12 +415,10 @@ begin
|
|||||||
DoneCriticalSection :=@SysDoneCriticalSection;
|
DoneCriticalSection :=@SysDoneCriticalSection;
|
||||||
EnterCriticalSection :=@SysEnterCriticalSection;
|
EnterCriticalSection :=@SysEnterCriticalSection;
|
||||||
LeaveCriticalSection :=@SysLeaveCriticalSection;
|
LeaveCriticalSection :=@SysLeaveCriticalSection;
|
||||||
{$ifdef hasthreadvar}
|
|
||||||
InitThreadVar :=@SysInitThreadVar;
|
InitThreadVar :=@SysInitThreadVar;
|
||||||
RelocateThreadVar :=@SysRelocateThreadVar;
|
RelocateThreadVar :=@SysRelocateThreadVar;
|
||||||
AllocateThreadVars :=@SysAllocateThreadVars;
|
AllocateThreadVars :=@SysAllocateThreadVars;
|
||||||
ReleaseThreadVars :=@SysReleaseThreadVars;
|
ReleaseThreadVars :=@SysReleaseThreadVars;
|
||||||
{$endif}
|
|
||||||
BasicEventCreate :=@intBasicEventCreate;
|
BasicEventCreate :=@intBasicEventCreate;
|
||||||
BasicEventDestroy :=@intBasicEventDestroy;
|
BasicEventDestroy :=@intBasicEventDestroy;
|
||||||
BasicEventResetEvent :=@intBasicEventResetEvent;
|
BasicEventResetEvent :=@intBasicEventResetEvent;
|
||||||
@ -437,9 +427,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
SetThreadManager(NWThreadManager);
|
SetThreadManager(NWThreadManager);
|
||||||
InitHeapMutexes;
|
InitHeapMutexes;
|
||||||
{$ifdef HASTHREADVAR}
|
|
||||||
ThVarAllocResourceTag := AllocateResourceTag(getnlmhandle,'Threadvar Memory',AllocSignature);
|
ThVarAllocResourceTag := AllocateResourceTag(getnlmhandle,'Threadvar Memory',AllocSignature);
|
||||||
{$endif}
|
|
||||||
NWSysSetThreadFunctions (@SysAllocateThreadVars,
|
NWSysSetThreadFunctions (@SysAllocateThreadVars,
|
||||||
@SysReleaseThreadVars,
|
@SysReleaseThreadVars,
|
||||||
@SysSetThreadDataAreaPtr);
|
@SysSetThreadDataAreaPtr);
|
||||||
|
|||||||
@ -131,12 +131,8 @@ external 'DOSCALLS' index 286;
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
{$ifdef HASTHREADVAR}
|
|
||||||
threadvar
|
threadvar
|
||||||
{$else HASTHREADVAR}
|
ExtKeyCode: char;
|
||||||
var
|
|
||||||
{$endif HASTHREADVAR}
|
|
||||||
ExtKeyCode: char;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -51,11 +51,7 @@ Type
|
|||||||
{Flags for the exec procedure:
|
{Flags for the exec procedure:
|
||||||
}
|
}
|
||||||
|
|
||||||
{$ifdef HASTHREADVAR}
|
|
||||||
threadvar
|
threadvar
|
||||||
{$else HASTHREADVAR}
|
|
||||||
var
|
|
||||||
{$endif HASTHREADVAR}
|
|
||||||
(* For compatibility with VP/2, used for runflags in Exec procedure. *)
|
(* For compatibility with VP/2, used for runflags in Exec procedure. *)
|
||||||
ExecFlags: cardinal;
|
ExecFlags: cardinal;
|
||||||
|
|
||||||
@ -81,11 +77,7 @@ implementation
|
|||||||
|
|
||||||
{$I dos.inc}
|
{$I dos.inc}
|
||||||
|
|
||||||
{$ifdef HASTHREADVAR}
|
|
||||||
threadvar
|
threadvar
|
||||||
{$else HASTHREADVAR}
|
|
||||||
var
|
|
||||||
{$endif HASTHREADVAR}
|
|
||||||
LastDosErrorModuleName: string;
|
LastDosErrorModuleName: string;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -417,11 +417,7 @@ asm
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
{$ifdef HASTHREADVAR}
|
|
||||||
threadvar
|
threadvar
|
||||||
{$else HASTHREADVAR}
|
|
||||||
var
|
|
||||||
{$endif HASTHREADVAR}
|
|
||||||
DefaultCreator: ShortString;
|
DefaultCreator: ShortString;
|
||||||
DefaultFileType: ShortString;
|
DefaultFileType: ShortString;
|
||||||
|
|
||||||
|
|||||||
@ -70,7 +70,6 @@ procedure DosSleep (MSec: cardinal); cdecl; external 'DOSCALLS' index 229;
|
|||||||
Threadvar support
|
Threadvar support
|
||||||
*****************************************************************************}
|
*****************************************************************************}
|
||||||
|
|
||||||
{$ifdef HASTHREADVAR}
|
|
||||||
const
|
const
|
||||||
ThreadVarBlockSize: dword = 0;
|
ThreadVarBlockSize: dword = 0;
|
||||||
|
|
||||||
@ -124,7 +123,6 @@ end;
|
|||||||
fpc_threadvar_relocate_proc := @SysRelocateThreadvar;
|
fpc_threadvar_relocate_proc := @SysRelocateThreadvar;
|
||||||
end;
|
end;
|
||||||
*)
|
*)
|
||||||
{$endif HASTHREADVAR}
|
|
||||||
|
|
||||||
|
|
||||||
{*****************************************************************************
|
{*****************************************************************************
|
||||||
@ -159,9 +157,7 @@ end;
|
|||||||
procedure DoneThread;
|
procedure DoneThread;
|
||||||
begin
|
begin
|
||||||
{ Release Threadvars }
|
{ Release Threadvars }
|
||||||
{$ifdef HASTHREADVAR}
|
|
||||||
SysReleaseThreadVars;
|
SysReleaseThreadVars;
|
||||||
{$endif HASTHREADVAR}
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
@ -169,11 +165,9 @@ end;
|
|||||||
var
|
var
|
||||||
ti : tthreadinfo;
|
ti : tthreadinfo;
|
||||||
begin
|
begin
|
||||||
{$ifdef HASTHREADVAR}
|
|
||||||
{ Allocate local thread vars, this must be the first thing,
|
{ Allocate local thread vars, this must be the first thing,
|
||||||
because the exception management and io depends on threadvars }
|
because the exception management and io depends on threadvars }
|
||||||
SysAllocateThreadVars;
|
SysAllocateThreadVars;
|
||||||
{$endif HASTHREADVAR}
|
|
||||||
{ Copy parameter to local data }
|
{ Copy parameter to local data }
|
||||||
{$ifdef DEBUG_MT}
|
{$ifdef DEBUG_MT}
|
||||||
writeln('New thread started, initialising ...');
|
writeln('New thread started, initialising ...');
|
||||||
@ -202,11 +196,9 @@ end;
|
|||||||
{ Initialize multithreading if not done }
|
{ Initialize multithreading if not done }
|
||||||
if not IsMultiThread then
|
if not IsMultiThread then
|
||||||
begin
|
begin
|
||||||
{$ifdef HASTHREADVAR}
|
|
||||||
if DosAllocThreadLocalMemory (1, DataIndex) <> 0
|
if DosAllocThreadLocalMemory (1, DataIndex) <> 0
|
||||||
then RunError (8);
|
then RunError (8);
|
||||||
InitThreadVars(@SysRelocateThreadVar);
|
InitThreadVars(@SysRelocateThreadVar);
|
||||||
{$endif HASTHREADVAR}
|
|
||||||
IsMultiThread:=true;
|
IsMultiThread:=true;
|
||||||
end;
|
end;
|
||||||
{ the only way to pass data to the newly created thread
|
{ the only way to pass data to the newly created thread
|
||||||
@ -521,12 +513,10 @@ begin
|
|||||||
DoneCriticalSection :=@SysDoneCriticalSection;
|
DoneCriticalSection :=@SysDoneCriticalSection;
|
||||||
EnterCriticalSection :=@SysEnterCriticalSection;
|
EnterCriticalSection :=@SysEnterCriticalSection;
|
||||||
LeaveCriticalSection :=@SysLeaveCriticalSection;
|
LeaveCriticalSection :=@SysLeaveCriticalSection;
|
||||||
{$ifdef HASTHREADVAR}
|
|
||||||
InitThreadVar :=@SysInitThreadVar;
|
InitThreadVar :=@SysInitThreadVar;
|
||||||
RelocateThreadVar :=@SysRelocateThreadVar;
|
RelocateThreadVar :=@SysRelocateThreadVar;
|
||||||
AllocateThreadVars :=@SysAllocateThreadVars;
|
AllocateThreadVars :=@SysAllocateThreadVars;
|
||||||
ReleaseThreadVars :=@SysReleaseThreadVars;
|
ReleaseThreadVars :=@SysReleaseThreadVars;
|
||||||
{$endif HASTHREADVAR}
|
|
||||||
BasicEventCreate :=@IntBasicEventCreate;
|
BasicEventCreate :=@IntBasicEventCreate;
|
||||||
BasicEventDestroy :=@IntBasicEventDestroy;
|
BasicEventDestroy :=@IntBasicEventDestroy;
|
||||||
BasicEventResetEvent :=@IntBasicEventResetEvent;
|
BasicEventResetEvent :=@IntBasicEventResetEvent;
|
||||||
|
|||||||
@ -60,7 +60,6 @@ Type PINTRTLEvent = ^TINTRTLEvent;
|
|||||||
Threadvar support
|
Threadvar support
|
||||||
*****************************************************************************}
|
*****************************************************************************}
|
||||||
|
|
||||||
{$ifdef HASTHREADVAR}
|
|
||||||
const
|
const
|
||||||
threadvarblocksize : dword = 0;
|
threadvarblocksize : dword = 0;
|
||||||
|
|
||||||
@ -127,7 +126,6 @@ Type PINTRTLEvent = ^TINTRTLEvent;
|
|||||||
|
|
||||||
{ Include OS independent Threadvar initialization }
|
{ Include OS independent Threadvar initialization }
|
||||||
|
|
||||||
{$endif HASTHREADVAR}
|
|
||||||
|
|
||||||
|
|
||||||
{*****************************************************************************
|
{*****************************************************************************
|
||||||
@ -145,9 +143,7 @@ Type PINTRTLEvent = ^TINTRTLEvent;
|
|||||||
procedure DoneThread;
|
procedure DoneThread;
|
||||||
begin
|
begin
|
||||||
{ Release Threadvars }
|
{ Release Threadvars }
|
||||||
{$ifdef HASTHREADVAR}
|
|
||||||
CReleaseThreadVars;
|
CReleaseThreadVars;
|
||||||
{$endif HASTHREADVAR}
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
@ -168,11 +164,9 @@ Type PINTRTLEvent = ^TINTRTLEvent;
|
|||||||
s := 'New thread started, initing threadvars'#10;
|
s := 'New thread started, initing threadvars'#10;
|
||||||
fpwrite(0,s[1],length(s));
|
fpwrite(0,s[1],length(s));
|
||||||
{$endif DEBUG_MT}
|
{$endif DEBUG_MT}
|
||||||
{$ifdef HASTHREADVAR}
|
|
||||||
{ Allocate local thread vars, this must be the first thing,
|
{ Allocate local thread vars, this must be the first thing,
|
||||||
because the exception management and io depends on threadvars }
|
because the exception management and io depends on threadvars }
|
||||||
CAllocateThreadVars;
|
CAllocateThreadVars;
|
||||||
{$endif HASTHREADVAR}
|
|
||||||
{ Copy parameter to local data }
|
{ Copy parameter to local data }
|
||||||
{$ifdef DEBUG_MT}
|
{$ifdef DEBUG_MT}
|
||||||
s := 'New thread started, initialising ...'#10;
|
s := 'New thread started, initialising ...'#10;
|
||||||
@ -205,11 +199,9 @@ Type PINTRTLEvent = ^TINTRTLEvent;
|
|||||||
{ Initialize multithreading if not done }
|
{ Initialize multithreading if not done }
|
||||||
if not IsMultiThread then
|
if not IsMultiThread then
|
||||||
begin
|
begin
|
||||||
{$ifdef HASTHREADVAR}
|
|
||||||
{ We're still running in single thread mode, setup the TLS }
|
{ We're still running in single thread mode, setup the TLS }
|
||||||
pthread_key_create(@TLSKey,nil);
|
pthread_key_create(@TLSKey,nil);
|
||||||
InitThreadVars(@CRelocateThreadvar);
|
InitThreadVars(@CRelocateThreadvar);
|
||||||
{$endif HASTHREADVAR}
|
|
||||||
IsMultiThread:=true;
|
IsMultiThread:=true;
|
||||||
end;
|
end;
|
||||||
{ the only way to pass data to the newly created thread
|
{ the only way to pass data to the newly created thread
|
||||||
@ -619,12 +611,10 @@ begin
|
|||||||
DoneCriticalSection :=@CDoneCriticalSection;
|
DoneCriticalSection :=@CDoneCriticalSection;
|
||||||
EnterCriticalSection :=@CEnterCriticalSection;
|
EnterCriticalSection :=@CEnterCriticalSection;
|
||||||
LeaveCriticalSection :=@CLeaveCriticalSection;
|
LeaveCriticalSection :=@CLeaveCriticalSection;
|
||||||
{$ifdef hasthreadvar}
|
|
||||||
InitThreadVar :=@CInitThreadVar;
|
InitThreadVar :=@CInitThreadVar;
|
||||||
RelocateThreadVar :=@CRelocateThreadVar;
|
RelocateThreadVar :=@CRelocateThreadVar;
|
||||||
AllocateThreadVars :=@CAllocateThreadVars;
|
AllocateThreadVars :=@CAllocateThreadVars;
|
||||||
ReleaseThreadVars :=@CReleaseThreadVars;
|
ReleaseThreadVars :=@CReleaseThreadVars;
|
||||||
{$endif}
|
|
||||||
BasicEventCreate :=@intBasicEventCreate;
|
BasicEventCreate :=@intBasicEventCreate;
|
||||||
BasicEventDestroy :=@intBasicEventDestroy;
|
BasicEventDestroy :=@intBasicEventDestroy;
|
||||||
BasicEventResetEvent :=@intBasicEventResetEvent;
|
BasicEventResetEvent :=@intBasicEventResetEvent;
|
||||||
|
|||||||
@ -66,7 +66,6 @@ CONST
|
|||||||
Threadvar support
|
Threadvar support
|
||||||
*****************************************************************************}
|
*****************************************************************************}
|
||||||
|
|
||||||
{$ifdef HASTHREADVAR}
|
|
||||||
const
|
const
|
||||||
threadvarblocksize : dword = 0;
|
threadvarblocksize : dword = 0;
|
||||||
|
|
||||||
@ -105,7 +104,6 @@ CONST
|
|||||||
GlobalFree(TlsGetValue(tlskey));
|
GlobalFree(TlsGetValue(tlskey));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{$endif HASTHREADVAR}
|
|
||||||
|
|
||||||
|
|
||||||
{*****************************************************************************
|
{*****************************************************************************
|
||||||
@ -123,9 +121,7 @@ CONST
|
|||||||
procedure DoneThread;
|
procedure DoneThread;
|
||||||
begin
|
begin
|
||||||
{ Release Threadvars }
|
{ Release Threadvars }
|
||||||
{$ifdef HASTHREADVAR}
|
|
||||||
SysReleaseThreadVars;
|
SysReleaseThreadVars;
|
||||||
{$endif HASTHREADVAR}
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
@ -133,11 +129,9 @@ CONST
|
|||||||
var
|
var
|
||||||
ti : tthreadinfo;
|
ti : tthreadinfo;
|
||||||
begin
|
begin
|
||||||
{$ifdef HASTHREADVAR}
|
|
||||||
{ Allocate local thread vars, this must be the first thing,
|
{ Allocate local thread vars, this must be the first thing,
|
||||||
because the exception management and io depends on threadvars }
|
because the exception management and io depends on threadvars }
|
||||||
SysAllocateThreadVars;
|
SysAllocateThreadVars;
|
||||||
{$endif HASTHREADVAR}
|
|
||||||
{ Copy parameter to local data }
|
{ Copy parameter to local data }
|
||||||
{$ifdef DEBUG_MT}
|
{$ifdef DEBUG_MT}
|
||||||
writeln('New thread started, initialising ...');
|
writeln('New thread started, initialising ...');
|
||||||
@ -167,11 +161,9 @@ CONST
|
|||||||
{ Initialize multithreading if not done }
|
{ Initialize multithreading if not done }
|
||||||
if not IsMultiThread then
|
if not IsMultiThread then
|
||||||
begin
|
begin
|
||||||
{$ifdef HASTHREADVAR}
|
|
||||||
{ We're still running in single thread mode, setup the TLS }
|
{ We're still running in single thread mode, setup the TLS }
|
||||||
TLSKey:=TlsAlloc;
|
TLSKey:=TlsAlloc;
|
||||||
InitThreadVars(@SysRelocateThreadvar);
|
InitThreadVars(@SysRelocateThreadvar);
|
||||||
{$endif HASTHREADVAR}
|
|
||||||
IsMultiThread:=true;
|
IsMultiThread:=true;
|
||||||
end;
|
end;
|
||||||
{ the only way to pass data to the newly created thread
|
{ the only way to pass data to the newly created thread
|
||||||
@ -447,12 +439,10 @@ begin
|
|||||||
DoneCriticalSection :=@SysDoneCriticalSection;
|
DoneCriticalSection :=@SysDoneCriticalSection;
|
||||||
EnterCriticalSection :=@SysEnterCriticalSection;
|
EnterCriticalSection :=@SysEnterCriticalSection;
|
||||||
LeaveCriticalSection :=@SysLeaveCriticalSection;
|
LeaveCriticalSection :=@SysLeaveCriticalSection;
|
||||||
{$ifdef HASTHREADVAR}
|
|
||||||
InitThreadVar :=@SysInitThreadVar;
|
InitThreadVar :=@SysInitThreadVar;
|
||||||
RelocateThreadVar :=@SysRelocateThreadVar;
|
RelocateThreadVar :=@SysRelocateThreadVar;
|
||||||
AllocateThreadVars :=@SysAllocateThreadVars;
|
AllocateThreadVars :=@SysAllocateThreadVars;
|
||||||
ReleaseThreadVars :=@SysReleaseThreadVars;
|
ReleaseThreadVars :=@SysReleaseThreadVars;
|
||||||
{$endif HASTHREADVAR}
|
|
||||||
BasicEventCreate :=@intBasicEventCreate;
|
BasicEventCreate :=@intBasicEventCreate;
|
||||||
BasicEventDestroy :=@intBasicEventDestroy;
|
BasicEventDestroy :=@intBasicEventDestroy;
|
||||||
BasicEventResetEvent :=@intBasicEventResetEvent;
|
BasicEventResetEvent :=@intBasicEventResetEvent;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user