Re: GUC thread-safety approaches - Mailing list pgsql-hackers

From Peter Eisentraut
Subject Re: GUC thread-safety approaches
Date
Msg-id 863f8394-0a22-4bb7-ba4c-8ae126d16907@eisentraut.org
Whole thread Raw
In response to Re: GUC thread-safety approaches  (Heikki Linnakangas <hlinnaka@iki.fi>)
List pgsql-hackers
On 18.11.25 15:15, Heikki Linnakangas wrote:
> PS. I found this blog post on how Thread Local Storage is implemented on 
> different systems very enlightening: https://maskray.me/blog/2021-02-14- 
> all-about-thread-local-storage. I think whatever scheme we come up with 
> will be a home-grown implementation of one the methods described in that 
> article.

I read this:

 > Windows TLS

 > Referencing a TLS variable from another DLL is not supported.
 >
 > __declspec(dllimport) extern thread_local int tls;
 > // error C2492: 'tls': data with thread storage duration may not have 
dll interface


So something like

extern PGDLLIMPORT thread_local struct Port *MyProcPort;

wouldn't work (confirmed).

That might be a problem, since we now mark all global variables as 
PGDLLIMPORT.





pgsql-hackers by date:

Previous
From: "Matheus Alcantara"
Date:
Subject: Re: postgres_fdw: Use COPY to speed up batch inserts
Next
From: Mihail Nikalayeu
Date:
Subject: Re: Bug in amcheck?