Re: Thred safety

Andrew Makhorin <[email protected]>
Newsgroups gmane.comp.gnu.glpk
Message-ID <1485798838.17522.6.camel@corvax>
> > I replaced all calls to gmtime, strerror, and strtok with corresponding
> > calls to wrappers xgmtime, xstrerr, and xstrtok (see env/stdc.c).
> >
> > At the moment the wrappers just call corresponding standard functions.
> > Any idea how to better implement them?
> 
> Until you have something better,
> sandwich the calls and the data-copying between a mutex lock and unlock.
> With threads, I expect implementation-dependent stuff.
> I expect it can be placed in a header file.
> 

I implemented the wrappers using thread-safe functions (i.e. gmtime_r,
strerror_r, and strtok_r) and thread local storage objects to store
static data. Please see
http://lists.gnu.org/archive/html/help-glpk/2017-01/msg00138.html .


Andrew Makhorin
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.