This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: zonefile changes and long running processes.


On 05/13/2014 02:14 PM, OndÅej BÃlka wrote:
tzstruct *ptr;
void tz_set_internal (tzstruct *set)
{
   tzstruct *old = atomic_exchange_acq (&ptr, set);
   if (old->malloced)
     free (old);
}

With this implementation, couldn't a tzset in one thread crash a localtime_r running in another thread? E.g., won't trouble occur if the other thread's localtime_r implementation accesses the malloced storage at the same time the tzset thread invokes "free (old)"? POSIX allows some leeway here, and I presume we want to exploit that to improve performance, but does POSIX allow localtime_r to have undefined behavior if some other thread is simultaneously invoking tzset?


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]