Re: Cleaning up threading code
Joe Conway <mail@joeconway.com>
From: Joe Conway <mail@joeconway.com>
To: Andres Freund <andres@anarazel.de>, Thomas Munro <thomas.munro@gmail.com>
Cc: pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2023-06-10T15:19:46Z
Lists: 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
Commits
-
Doc: Adjust libpq docs about thread safety.
- ce0b0fa3e792 17.0 landed
-
Remove --disable-thread-safety and related code.
- 68a4b58eca03 17.0 landed
-
Rename port/thread.c to port/user.c.
- 89333db963af 17.0 landed
-
Remove obsolete comment and code from fe-auth.c.
- 1aadc504bf47 17.0 landed