+ Removed HASTHREADVAR SUPPORT_THREADVAR defines

git-svn-id: trunk@295 -
This commit is contained in:
michael 2005-06-09 17:40:29 +00:00
parent a775d3d487
commit 859bb30daa
18 changed files with 2 additions and 110 deletions

View File

@ -101,11 +101,7 @@ const
function GetEnvPChar (EnvVar: string): PChar;
{$ifdef HASTHREADVAR}
threadvar
{$else HASTHREADVAR}
var
{$endif HASTHREADVAR}
(* For compatibility with VP/2, used for runflags in Exec procedure. *)
ExecFlags: cardinal;
@ -126,11 +122,7 @@ const
{$I dos.inc}
{$ifdef HASTHREADVAR}
threadvar
{$else HASTHREADVAR}
var
{$endif HASTHREADVAR}
LastSR: SearchRec;
var

View File

@ -416,11 +416,7 @@ begin
end;
{$ifdef HASTHREADVAR}
threadvar
{$else HASTHREADVAR}
var
{$endif HASTHREADVAR}
DefaultCreator: ShortString;
DefaultFileType: ShortString;

View File

@ -74,7 +74,6 @@ function DosExitCritSec:cardinal; cdecl; external 'DOSCALLS' index 233;
Threadvar support
*****************************************************************************}
{$ifdef HASTHREADVAR}
const
ThreadVarBlockSize: dword = 0;
@ -128,7 +127,6 @@ end;
fpc_threadvar_relocate_proc := @SysRelocateThreadvar;
end;
{$endif HASTHREADVAR}
{*****************************************************************************

View File

@ -196,11 +196,7 @@ begin
end;
{$ifdef HASTHREADVAR}
threadvar
{$else HASTHREADVAR}
var
{$endif HASTHREADVAR}
CurrX, CurrY: dword;

View File

@ -21,11 +21,7 @@ const
ExtensionSeparator = '.';
{$IFNDEF HAS_DOSEXITCODE}
{$IFDEF HASTHREADVAR}
threadvar
{$ELSE HASTHREADVAR}
var
{$ENDIF HASTHREADVAR}
LastDosExitCode: longint;
function DosExitCode: word;

View File

@ -81,11 +81,7 @@ Type
Sec : word;
End;
{$ifdef HASTHREADVAR}
threadvar
{$else HASTHREADVAR}
var
{$endif HASTHREADVAR}
DosError : integer;
{$ifdef cpui386}

View File

@ -37,11 +37,8 @@ Type
Const
CatchAllExceptions : PtrInt = -1;
{$ifdef SUPPORT_THREADVAR}
ThreadVar
{$else SUPPORT_THREADVAR}
Var
{$endif SUPPORT_THREADVAR}
ExceptAddrStack : PExceptAddr;
ExceptObjectStack : PExceptObject;

View File

@ -28,9 +28,6 @@
{$endif}
{ Use threadvars when the compiler supports it }
{$ifdef HASTHREADVAR}
{$define SUPPORT_THREADVAR}
{$endif HASTHREADVAR}
{ don't use FPU registervariables on the i386 }
{$ifdef CPUI386}
@ -352,11 +349,7 @@ var
{ Threading support }
fpc_threadvar_relocate_proc : pointer; public name 'FPC_THREADVAR_RELOCATE';
{$ifdef SUPPORT_THREADVAR}
ThreadVar
{$else SUPPORT_THREADVAR}
Var
{$endif SUPPORT_THREADVAR}
ThreadID : TThreadID;
{ Standard In- and Output }
ErrOutput,

View File

@ -96,9 +96,7 @@ Function SetThreadManager(Const NewTM : TThreadManager) : Boolean;
Procedure SetNoThreadManager;
{$endif DISABLE_NO_THREAD_MANAGER}
// Needs to be exported, so the manager can call it.
{$ifdef HASTHREADVAR}
procedure InitThreadVars(RelocProc : Pointer);
{$endif HASTHREADVAR}
procedure InitThread(stklen:cardinal);
{*****************************************************************************

View File

@ -19,7 +19,6 @@
Threadvar support
*****************************************************************************}
{$ifdef HASTHREADVAR}
type
pltvInitEntry = ^ltvInitEntry;
@ -97,5 +96,4 @@ begin
fpc_threadvar_relocate_proc:=RelocProc;
end;
{$endif HASTHREADVAR}

View File

@ -31,7 +31,6 @@
Threadvar support
*****************************************************************************}
{$ifdef HASTHREADVAR}
const
threadvarblocksize : dword = 0; // total size of allocated threadvars
@ -106,7 +105,6 @@ begin
end;
end;
{$endif HASTHREADVAR}
{*****************************************************************************
@ -127,9 +125,7 @@ procedure DoneThread;
begin
{ release thread vars }
{$ifdef HASTHREADVAR}
SysReleaseThreadVars;
{$endif}
end;
@ -139,11 +135,9 @@ function ThreadMain(param : pointer) : dword; cdecl;
ti : tthreadinfo;
begin
{$ifdef HASTHREADVAR}
{ Allocate local thread vars, this must be the first thing,
because the exception management and io depends on threadvars }
SysAllocateThreadVars;
{$endif HASTHREADVAR}
{$ifdef DEBUG_MT}
ConsolePrintf(#13'New thread %x started, initialising ...'#13#10,_GetThreadID);
{$endif DEBUG_MT}
@ -167,13 +161,11 @@ function SysBeginThread(sa : Pointer;stacksize : dword;
{$ifdef DEBUG_MT}
ConsolePrintf(#13'Creating new thread'#13#10);
{$endif DEBUG_MT}
{$ifdef HASTHREADVAR}
if not IsMultiThread then
begin
InitThreadVars(@SysRelocateThreadvar);
IsMultithread:=true;
end;
{$endif}
{ the only way to pass data to the newly created thread }
{ in a MT safe way, is to use the heap }
new(ti);
@ -472,12 +464,10 @@ begin
DoneCriticalSection :=@SysDoneCriticalSection;
EnterCriticalSection :=@SysEnterCriticalSection;
LeaveCriticalSection :=@SysLeaveCriticalSection;
{$ifdef HASTHREADVAR}
InitThreadVar :=@SysInitThreadVar;
RelocateThreadVar :=@SysRelocateThreadVar;
AllocateThreadVars :=@SysAllocateThreadVars;
ReleaseThreadVars :=@SysReleaseThreadVars;
{$endif HASTHREADVAR}
BasicEventCreate :=@NoBasicEventCreate;
basiceventdestroy :=@Nobasiceventdestroy;
basiceventResetEvent :=@NobasiceventResetEvent;

View File

@ -27,7 +27,6 @@
Threadvar support
*****************************************************************************}
{$ifdef HASTHREADVAR}
const
threadvarblocksize : dword = 0;
thredvarsmainthread: pointer = nil; // to free the threadvars in the signal handler
@ -82,7 +81,6 @@
pthread_setspecific(tlskey,newPtr);
end;
{$endif HASTHREADVAR}
{*****************************************************************************
@ -100,10 +98,8 @@
procedure DoneThread;
begin
{ Release Threadvars }
{$ifdef HASTHREADVAR}
WRITE_DEBUG('DoneThread, releasing threadvars'#13#10);
SysReleaseThreadVars;
{$endif HASTHREADVAR}
end;
@ -112,11 +108,9 @@
ti : tthreadinfo;
begin
WRITE_DEBUG('New thread started, initing threadvars'#13#10);
{$ifdef HASTHREADVAR}
{ Allocate local thread vars, this must be the first thing,
because the exception management and io depends on threadvars }
SysAllocateThreadVars;
{$endif HASTHREADVAR}
{ Copy parameter to local data }
WRITE_DEBUG('New thread started, initialising ...'#13#10);
ti:=pthreadinfo(param)^;
@ -143,11 +137,9 @@
{ Initialize multithreading if not done }
if not IsMultiThread then
begin
{$ifdef HASTHREADVAR}
{ We're still running in single thread mode, setup the TLS }
pthread_key_create(@TLSKey,nil);
InitThreadVars(@SysRelocateThreadvar);
{$endif HASTHREADVAR}
IsMultiThread:=true;
end;
{ the only way to pass data to the newly created thread
@ -423,12 +415,10 @@ begin
DoneCriticalSection :=@SysDoneCriticalSection;
EnterCriticalSection :=@SysEnterCriticalSection;
LeaveCriticalSection :=@SysLeaveCriticalSection;
{$ifdef hasthreadvar}
InitThreadVar :=@SysInitThreadVar;
RelocateThreadVar :=@SysRelocateThreadVar;
AllocateThreadVars :=@SysAllocateThreadVars;
ReleaseThreadVars :=@SysReleaseThreadVars;
{$endif}
BasicEventCreate :=@intBasicEventCreate;
BasicEventDestroy :=@intBasicEventDestroy;
BasicEventResetEvent :=@intBasicEventResetEvent;
@ -437,9 +427,7 @@ begin
end;
SetThreadManager(NWThreadManager);
InitHeapMutexes;
{$ifdef HASTHREADVAR}
ThVarAllocResourceTag := AllocateResourceTag(getnlmhandle,'Threadvar Memory',AllocSignature);
{$endif}
NWSysSetThreadFunctions (@SysAllocateThreadVars,
@SysReleaseThreadVars,
@SysSetThreadDataAreaPtr);

View File

@ -131,12 +131,8 @@ external 'DOSCALLS' index 286;
{$ifdef HASTHREADVAR}
threadvar
{$else HASTHREADVAR}
var
{$endif HASTHREADVAR}
ExtKeyCode: char;
ExtKeyCode: char;

View File

@ -51,11 +51,7 @@ Type
{Flags for the exec procedure:
}
{$ifdef HASTHREADVAR}
threadvar
{$else HASTHREADVAR}
var
{$endif HASTHREADVAR}
(* For compatibility with VP/2, used for runflags in Exec procedure. *)
ExecFlags: cardinal;
@ -81,11 +77,7 @@ implementation
{$I dos.inc}
{$ifdef HASTHREADVAR}
threadvar
{$else HASTHREADVAR}
var
{$endif HASTHREADVAR}
LastDosErrorModuleName: string;

View File

@ -417,11 +417,7 @@ asm
end;
{$ifdef HASTHREADVAR}
threadvar
{$else HASTHREADVAR}
var
{$endif HASTHREADVAR}
DefaultCreator: ShortString;
DefaultFileType: ShortString;

View File

@ -70,7 +70,6 @@ procedure DosSleep (MSec: cardinal); cdecl; external 'DOSCALLS' index 229;
Threadvar support
*****************************************************************************}
{$ifdef HASTHREADVAR}
const
ThreadVarBlockSize: dword = 0;
@ -124,7 +123,6 @@ end;
fpc_threadvar_relocate_proc := @SysRelocateThreadvar;
end;
*)
{$endif HASTHREADVAR}
{*****************************************************************************
@ -159,9 +157,7 @@ end;
procedure DoneThread;
begin
{ Release Threadvars }
{$ifdef HASTHREADVAR}
SysReleaseThreadVars;
{$endif HASTHREADVAR}
end;
@ -169,11 +165,9 @@ end;
var
ti : tthreadinfo;
begin
{$ifdef HASTHREADVAR}
{ Allocate local thread vars, this must be the first thing,
because the exception management and io depends on threadvars }
SysAllocateThreadVars;
{$endif HASTHREADVAR}
{ Copy parameter to local data }
{$ifdef DEBUG_MT}
writeln('New thread started, initialising ...');
@ -202,11 +196,9 @@ end;
{ Initialize multithreading if not done }
if not IsMultiThread then
begin
{$ifdef HASTHREADVAR}
if DosAllocThreadLocalMemory (1, DataIndex) <> 0
then RunError (8);
InitThreadVars(@SysRelocateThreadVar);
{$endif HASTHREADVAR}
IsMultiThread:=true;
end;
{ the only way to pass data to the newly created thread
@ -521,12 +513,10 @@ begin
DoneCriticalSection :=@SysDoneCriticalSection;
EnterCriticalSection :=@SysEnterCriticalSection;
LeaveCriticalSection :=@SysLeaveCriticalSection;
{$ifdef HASTHREADVAR}
InitThreadVar :=@SysInitThreadVar;
RelocateThreadVar :=@SysRelocateThreadVar;
AllocateThreadVars :=@SysAllocateThreadVars;
ReleaseThreadVars :=@SysReleaseThreadVars;
{$endif HASTHREADVAR}
BasicEventCreate :=@IntBasicEventCreate;
BasicEventDestroy :=@IntBasicEventDestroy;
BasicEventResetEvent :=@IntBasicEventResetEvent;

View File

@ -60,7 +60,6 @@ Type PINTRTLEvent = ^TINTRTLEvent;
Threadvar support
*****************************************************************************}
{$ifdef HASTHREADVAR}
const
threadvarblocksize : dword = 0;
@ -127,7 +126,6 @@ Type PINTRTLEvent = ^TINTRTLEvent;
{ Include OS independent Threadvar initialization }
{$endif HASTHREADVAR}
{*****************************************************************************
@ -145,9 +143,7 @@ Type PINTRTLEvent = ^TINTRTLEvent;
procedure DoneThread;
begin
{ Release Threadvars }
{$ifdef HASTHREADVAR}
CReleaseThreadVars;
{$endif HASTHREADVAR}
end;
@ -168,11 +164,9 @@ Type PINTRTLEvent = ^TINTRTLEvent;
s := 'New thread started, initing threadvars'#10;
fpwrite(0,s[1],length(s));
{$endif DEBUG_MT}
{$ifdef HASTHREADVAR}
{ Allocate local thread vars, this must be the first thing,
because the exception management and io depends on threadvars }
CAllocateThreadVars;
{$endif HASTHREADVAR}
{ Copy parameter to local data }
{$ifdef DEBUG_MT}
s := 'New thread started, initialising ...'#10;
@ -205,11 +199,9 @@ Type PINTRTLEvent = ^TINTRTLEvent;
{ Initialize multithreading if not done }
if not IsMultiThread then
begin
{$ifdef HASTHREADVAR}
{ We're still running in single thread mode, setup the TLS }
pthread_key_create(@TLSKey,nil);
InitThreadVars(@CRelocateThreadvar);
{$endif HASTHREADVAR}
IsMultiThread:=true;
end;
{ the only way to pass data to the newly created thread
@ -619,12 +611,10 @@ begin
DoneCriticalSection :=@CDoneCriticalSection;
EnterCriticalSection :=@CEnterCriticalSection;
LeaveCriticalSection :=@CLeaveCriticalSection;
{$ifdef hasthreadvar}
InitThreadVar :=@CInitThreadVar;
RelocateThreadVar :=@CRelocateThreadVar;
AllocateThreadVars :=@CAllocateThreadVars;
ReleaseThreadVars :=@CReleaseThreadVars;
{$endif}
BasicEventCreate :=@intBasicEventCreate;
BasicEventDestroy :=@intBasicEventDestroy;
BasicEventResetEvent :=@intBasicEventResetEvent;

View File

@ -66,7 +66,6 @@ CONST
Threadvar support
*****************************************************************************}
{$ifdef HASTHREADVAR}
const
threadvarblocksize : dword = 0;
@ -105,7 +104,6 @@ CONST
GlobalFree(TlsGetValue(tlskey));
end;
{$endif HASTHREADVAR}
{*****************************************************************************
@ -123,9 +121,7 @@ CONST
procedure DoneThread;
begin
{ Release Threadvars }
{$ifdef HASTHREADVAR}
SysReleaseThreadVars;
{$endif HASTHREADVAR}
end;
@ -133,11 +129,9 @@ CONST
var
ti : tthreadinfo;
begin
{$ifdef HASTHREADVAR}
{ Allocate local thread vars, this must be the first thing,
because the exception management and io depends on threadvars }
SysAllocateThreadVars;
{$endif HASTHREADVAR}
{ Copy parameter to local data }
{$ifdef DEBUG_MT}
writeln('New thread started, initialising ...');
@ -167,11 +161,9 @@ CONST
{ Initialize multithreading if not done }
if not IsMultiThread then
begin
{$ifdef HASTHREADVAR}
{ We're still running in single thread mode, setup the TLS }
TLSKey:=TlsAlloc;
InitThreadVars(@SysRelocateThreadvar);
{$endif HASTHREADVAR}
IsMultiThread:=true;
end;
{ the only way to pass data to the newly created thread
@ -447,12 +439,10 @@ begin
DoneCriticalSection :=@SysDoneCriticalSection;
EnterCriticalSection :=@SysEnterCriticalSection;
LeaveCriticalSection :=@SysLeaveCriticalSection;
{$ifdef HASTHREADVAR}
InitThreadVar :=@SysInitThreadVar;
RelocateThreadVar :=@SysRelocateThreadVar;
AllocateThreadVars :=@SysAllocateThreadVars;
ReleaseThreadVars :=@SysReleaseThreadVars;
{$endif HASTHREADVAR}
BasicEventCreate :=@intBasicEventCreate;
BasicEventDestroy :=@intBasicEventDestroy;
BasicEventResetEvent :=@intBasicEventResetEvent;