Open jwaldmann opened 11 years ago
I am afraid GLPK is not thread-safe. In the Reference Manual it says "Currently GLPK API routines are non-reentrant and therefore cannot be used in multi-threaded programs". Which is too bad for a functional interface. I didn't notice it.
Ouch. Short of rewriting glpk, perhaps we can do the following:
for my present application, IO would be acceptable.
Yes, we can do something like this, otherwise the library is very unsafe. No parallelism but at least we avoid the segfault. If I had time I would be tempted to write a reference simplex implementation using hmatrix...
I have an application where I forkIO some threads, each calling Numeric.LinearProgramming.simplex.
Using +RTS -N I get segfaults, e.g.,
When I do this with the non-threaded RTS, it works fine.
hmatrix-glpk-0.3.1 , ghc-7.6.2 , linux-amd64 , kernel 3.5.0 , libglpk0 4.45