[webkit-changes] cvs commit: JavaScriptCore/pcre pcre.h
pcre_compile.c pcre_exec.c
Maciej Stachowiak
mjs at apple.com
Sat Jan 7 20:34:15 PST 2006
On Jan 7, 2006, at 8:11 PM, Maciej Stachowiak wrote:
>
> On Jan 6, 2006, at 4:31 PM, Geoffrey Garen wrote:
>
>> We originally switched to the _r variants to prevent two localtime
>> () calls in the same stack from stomping each other. This method
>> accomplishes that just as well.
>>
>> For thread safety, we're counting on OS's to use thread-local-
>> storage for globals.
>
> Nothing in this change will protect you from two threads that call
> localtime at once. What does "thread-local storage for globals"
> have to do with it? localtime is not required to use thread-local
> storage for the struct tm it gives you a pointer to, and probably
> doesn't on most platforms. This should be fixed.
I think we want this:
+struct tm *gmtime_r(time_t *_clock, struct tm *_result)
+{
+ _gmtime64_s(_result, _clock);
+ return _result;
+}
+
+struct tm *localtime_r(time_t *_clock, struct tm *_result)
+{
+ _localtime64_s(_result, _clock);
+ return _result;
+}
But I'm reluctant to try it without a win32 system to test on. (I'm
not sure if we want the 64-bit versions of those _s functions or not
but they do seem like the right thing for windows).
Regards,
Maciej
More information about the webkit-changes
mailing list