Re: Cleaning up threading code - Mailing list pgsql-hackers

From Joe Conway
Subject Re: Cleaning up threading code
Date
Msg-id 7c7209e1-3ecc-877f-07a2-d2e44f1591af@joeconway.com
Whole thread Raw
In response to Re: Cleaning up threading code  (Andres Freund <andres@anarazel.de>)
List pgsql-hackers
On 6/10/23 01:26, Andres Freund wrote:
> On 2023-06-10 14:23:52 +1200, Thomas Munro wrote:
>> I'm not talking
>> about other stuff like C11 atomics, memory models, and the
>> thread_local storage class, which are all very good and interesting
>> topics for another day.
> 
> Hm. I agree on C11 atomics and memory models, but I don't see a good reason to
> not add support for thread_local?

Perhaps obvious to most/all on this thread, but something that bit me 
recently to keep in mind as we contemplate threads.

When a shared object library (e.g. extensions) is loaded, the init() 
function, and any functions marked with the constructor attribute, are 
executed. However they are not run again during thread_start().

So if there is thread local state that needs to be initialized, the 
initialization needs to be manually redone in each thread. Unless there 
is some mechanism similar to a constructor that I missed?

-- 
Joe Conway
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com




pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: abi-compliance-checker
Next
From: Andrew Dunstan
Date:
Subject: Re: Do we want a hashset type?