mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-11-03 09:09:26 +01:00
* when typecasting the result of pthread_self, always call it using
pthread_self(), because it's a procvar under Linux and hence otherwise
the value of the procvar instead of the function result will be
taken (mantis #15821)
git-svn-id: trunk@15049 -
This commit is contained in:
parent
653974f679
commit
4d8f578e4c
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -10316,6 +10316,7 @@ tests/webtbs/tw15777d.pp svneol=native#text/plain
|
||||
tests/webtbs/tw15777e.pp svneol=native#text/plain
|
||||
tests/webtbs/tw15777f.pp svneol=native#text/plain
|
||||
tests/webtbs/tw15812.pp svneol=native#text/plain
|
||||
tests/webtbs/tw15821.pp svneol=native#text/plain
|
||||
tests/webtbs/tw15843.pp svneol=native#text/plain
|
||||
tests/webtbs/tw15909.pp svneol=native#text/plain
|
||||
tests/webtbs/tw1592.pp svneol=native#text/plain
|
||||
|
||||
@ -600,7 +600,7 @@ begin
|
||||
{$ifdef has_sem_open}
|
||||
{ avoid a potential temporary nameclash with another process/thread }
|
||||
str(fpGetPid,semname);
|
||||
str(ptruint(pthread_self),tid);
|
||||
str(ptruint(pthread_self()),tid);
|
||||
semname:='/FPC'+semname+'T'+tid+#0;
|
||||
cIntSemaphoreInit:=cIntSemaphoreOpen(@semname[1],initvalue);
|
||||
{$else}
|
||||
@ -912,7 +912,7 @@ begin
|
||||
{$else}
|
||||
Result:=LoadPthreads;
|
||||
{$endif}
|
||||
ThreadID := TThreadID (pthread_self);
|
||||
ThreadID := TThreadID (pthread_self());
|
||||
{$ifdef DEBUG_MT}
|
||||
Writeln('InitThreads : ',Result);
|
||||
{$endif DEBUG_MT}
|
||||
|
||||
18
tests/webtbs/tw15821.pp
Normal file
18
tests/webtbs/tw15821.pp
Normal file
@ -0,0 +1,18 @@
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
uses
|
||||
{$ifdef unix}
|
||||
cthreads,
|
||||
{$endif}
|
||||
Classes;
|
||||
|
||||
begin
|
||||
writeln('GetThreadID=', ptrint(GetThreadID));
|
||||
writeln('GetCurrentThreadID=', ptrint(GetCurrentThreadId));
|
||||
writeln('MainThreadID=', ptrint(MainThreadID));
|
||||
if (GetThreadID<>GetCurrentThreadID) or
|
||||
(MainThreadID<>GetThreadID) then
|
||||
halt(1);
|
||||
end.
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user