Re: Thred safety

Andrew Makhorin <[email protected]>
Newsgroups gmane.comp.gnu.glpk
Message-ID <1485683704.4629.8.camel@corvax>
> If a multithreaded application calls the same GLPK library function in
> two threads at the same time, unexpected results may occur.
> 
> Gmtime, strerror and strtok use one global buffer each for all
> threads.
> 
> They do not use thread local memory.
> 

Probably you are right. (At least glibc 2.24 does not use tls.)

To resolve this issue I think to use wrappers for these functions (e.g.
xstrtok) implemented on a per-thread basis.


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.