* 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:
Jonas Maebe 2010-03-24 21:51:07 +00:00
parent 653974f679
commit 4d8f578e4c
3 changed files with 21 additions and 2 deletions

1
.gitattributes vendored
View File

@ -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

View File

@ -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
View 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.