[tz] WG14/C localtime_r draft is not reentrant
eggert at cs.ucla.edu
Sun Aug 18 00:38:07 UTC 2019
Brian Inglis wrote:
> WG14/C is looking at:
> which seems somewhat based on the POSIX standard.
Thanks for the heads-up. I see that this WG14/C draft is calling localtime_r
"reentrant", but it's not: in POSIX, localtime_r relies on global state to
obtain the time zone, and behavior is undefined if one thread calls localtime_r
while another thread is changing the time zone. Similarly for some of the other
"reentrant" functions mentioned in that draft.
If WG14 wants reentrant, it should standardize localtime_rz etc. a la tzcode and
NetBSD. These functions avoid the races inherent to localtime_r etc. I'll cc.
this to Jens Gustedt to give the draft's author a heads-up. Even if WG14 decides
to stick with POSIXish rather than reentrant functions, the rationale document
should explain why.
More information about the tz