mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-26 06:10:18 +02:00
* don't destroy LastError when resolving a threadvar on windows, resolves #10205 (?)
git-svn-id: trunk@10621 -
This commit is contained in:
parent
fce221f9b4
commit
6c5471f324
@ -826,7 +826,6 @@ destructor TThreadList.Destroy;
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
procedure TThreadList.Add(Item: Pointer);
|
procedure TThreadList.Add(Item: Pointer);
|
||||||
begin
|
begin
|
||||||
LockList;
|
LockList;
|
||||||
@ -876,5 +875,3 @@ procedure TThreadList.UnlockList;
|
|||||||
begin
|
begin
|
||||||
System.LeaveCriticalSection(FLock);
|
System.LeaveCriticalSection(FLock);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
@ -173,6 +173,9 @@ threadvar
|
|||||||
function GetLastError : DWORD;
|
function GetLastError : DWORD;
|
||||||
{$ifdef wince}cdecl{$else}stdcall{$endif};external KernelDLL name 'GetLastError';
|
{$ifdef wince}cdecl{$else}stdcall{$endif};external KernelDLL name 'GetLastError';
|
||||||
|
|
||||||
|
procedure SetLastError(dwErrCode : DWORD);
|
||||||
|
{$ifdef wince}cdecl{$else}stdcall{$endif};external KernelDLL name 'SetLastError';
|
||||||
|
|
||||||
{ time and date functions }
|
{ time and date functions }
|
||||||
function GetTickCount : longint;
|
function GetTickCount : longint;
|
||||||
{$ifdef wince}cdecl{$else}stdcall{$endif};external KernelDLL name 'GetTickCount';
|
{$ifdef wince}cdecl{$else}stdcall{$endif};external KernelDLL name 'GetTickCount';
|
||||||
|
@ -99,20 +99,41 @@ CONST
|
|||||||
TlsSetValue(tlskey,dataindex);
|
TlsSetValue(tlskey,dataindex);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
function SysRelocateThreadvar(offset : dword) : pointer;
|
function SysRelocateThreadvar(offset : dword) : pointer;
|
||||||
var
|
var
|
||||||
dataindex : pointer;
|
dataindex : pointer;
|
||||||
|
errorsave : dword;
|
||||||
begin
|
begin
|
||||||
dataindex := TlsGetValue(tlskey);
|
{$ifdef dummy}
|
||||||
if dataindex = nil then begin
|
{ I've no clue why this doesn't read dataindex, imo it should (FK) }
|
||||||
SysAllocateThreadVars;
|
asm
|
||||||
dataindex := TlsGetValue(tlskey);
|
movl TLSKey,%edx
|
||||||
|
movl $0x2c,%eax
|
||||||
|
movl %fs:(%eax),%eax
|
||||||
|
movl (%eax,%edx,4),%eax
|
||||||
|
movl %eax,dataindex
|
||||||
end;
|
end;
|
||||||
SysRelocateThreadvar:=DataIndex+Offset;
|
if DataIndex=nil then
|
||||||
{
|
|
||||||
begin
|
begin
|
||||||
SysRelocateThreadvar:=TlsGetValue(tlskey)+Offset;
|
errorsave:=GetLastError;
|
||||||
} end;
|
SysAllocateThreadVars;
|
||||||
|
DataIndex:=TlsGetValue(tlskey);
|
||||||
|
SetLastError(errorsave);
|
||||||
|
end;
|
||||||
|
{$else win32}
|
||||||
|
errorsave:=GetLastError;
|
||||||
|
dataindex:=TlsGetValue(tlskey);
|
||||||
|
if dataindex=nil then
|
||||||
|
begin
|
||||||
|
SysAllocateThreadVars;
|
||||||
|
dataindex:=TlsGetValue(tlskey);
|
||||||
|
end;
|
||||||
|
SetLastError(errorsave);
|
||||||
|
{$endif win32}
|
||||||
|
SysRelocateThreadvar:=DataIndex+Offset;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
procedure SysReleaseThreadVars;
|
procedure SysReleaseThreadVars;
|
||||||
begin
|
begin
|
||||||
|
Loading…
Reference in New Issue
Block a user