[tz] Thread-safe localtime(3) (was Re: Reading binary files)
Guy Harris
guy at alum.mit.edu
Wed Nov 2 23:10:39 UTC 2011
On Nov 2, 2011, at 3:49 PM, Christos Zoulas wrote:
> On Nov 2, 12:08pm, guy at alum.mit.edu (Guy Harris) wrote:
>
> | Presumably the timezone_t is needed for the time zone name, as
>
> No, it is the loaded tzstate.
The timezone_t is a pointer to the loaded tzstate, is it not?
strftime() only needs time zone information for the time zone name and offset, unless I'm missing something.
> | I think having APIs that explicitly take a loaded time zone as an argument is something we should do, as thread safety isn't the only issue; there are reasons to have more than one time zone used for time conversions within a given single thread of control.
>
> That is what has been done;
It's what has been done in NetBSD; it's not what has been done, yet, in the tzcode.
> why do you think otherwise?
Because *nothing* has been done yet in the tzcode, which is what we're discussing.
I'm trying to indicate that "make the tzstate per-thread data" may solve the thread-safety problem but won't solve other problems, so I'd vote for APIs that take a loaded time zone as an argument, such as the NetBSD ones, rather than just making the tzstate per-thread data.
More information about the tz
mailing list