help-glpk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-glpk] Thred safety


From: Andrew Makhorin
Subject: Re: [Help-glpk] Thred safety
Date: Sun, 29 Jan 2017 14:53:38 +0300

Hi Heinrich,

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

Please see a draft of glpk 4.62 here:
http://sourceforge.net/projects/noumenon/files/tmp/

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?

Best regards,

Andrew Makhorin




reply via email to

[Prev in Thread] Current Thread [Next in Thread]