Re: pthread portability

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Christoph Moench-Tegeder <cmt(at)burggraben(dot)net>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: pthread portability
Date: 2016-03-29 13:42:55
Message-ID: 30943.1459258975@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Christoph Moench-Tegeder <cmt(at)burggraben(dot)net> writes:
> ## Alvaro Herrera (alvherre(at)2ndquadrant(dot)com):
>>> The below diff fixes one problem: you can't compare pthread_t values
>>> directly. Only the function pthread_equal(3) is defined. Direct
>>> comparison usually works because most implementations define pthread_t
>>> as an integer type.

>> So is there a platform where this assumption doesn't hold?

> E.g. FreeBSD has "typedef struct pthread *pthread_t;" with a
> non-trivial "struct pthread".

Seems like pointer comparison would be sufficient in that case, so
I'm still not following what real-world problem this change fixes.

I read the POSIX spec's rationale for pthread_equal and found it
utterly unconvincing, BTW. If pthread_equal tries to dereference
the given pointer and said pointer is stale, what is the reason
to think it even points to still-allocated memory?

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message David Steele 2016-03-29 13:48:27 Re: improving GROUP BY estimation
Previous Message David Steele 2016-03-29 13:41:07 Re: [PROPOSAL] Client Log Output Filtering