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