I would like to know if GLPK is thread-safe or not. It seems it's using
a global "pointer" (in the glplib1a.c file) variable quite intensively,
thus I imagine GLPK is not thread-safe. I have not investigated very
much in the code of GLPK, so maybe I have missed a crucial point about
this subject.
All glpk routines are reenterable except two platform-dependent routines
lib_set_ptr and lib_get_ptr which are placed in file glplib1a.c. A generic
version of these routines uses a static storage to store the pointer (to
glpk environmental block). There is a version of these routines for
32-bit Windows (sysdep/w32/glplib1a.c) which uses TLS, so that version
is reenterable; however, for GNU/Linux such a version is not implemented.
Reentarabiliy differs from thread-safety in the sense that though
reenterable routines can be used in a multi-thread program, different
threads cannot share the same program object (LPX), because the glpk
routines have no synchronization features.