Re: things I don't understand in src/env/time.c + bugs + suggested patch

Chris Matrakidis <[email protected]>
Newsgroups gmane.comp.gnu.glpk
Message-ID <CAEaJ3S6Mq1jOXYoUNPHa4_gEkfwQgK_hvJJmw57Dtw78rPfoXw@mail.gmail.com>
Hi Andrew,

> As Heinrich noticed, gmtime, strerror, and strtok are non-thread-safe

Checking the online MSDN documentation, I see that strtok is also safe
on Windows for multiple threads, but It isn't clear what happens for
strerror - it is implied that a pointer to a fixed string is returned
but there is no explicit mention of threads.
That being said, I think it is better to use the _s functions on
windows, so that linking will fail in old version where there may be
issues.

> The problem I
> encountered is that gcc (Debian 4.7.2-5) 4.7.2 installed on my Linux
> machine doesn't have gmtime_s, strerror_s, and strtok_s.

My understanding is that it is unlikely that a version will be
provided by glibc.

> It is unclear
> what to do if no thread-safe version of these functions are available.

I think that configure should check for the posix versions or the
windows versions and fail if not found when TLS is set. I can prepare
a patch for this, but I can only test it on Linux.

Best Regards,

Chris Matrakidis
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.