In the README it says libzahl isn’t thread safe. I’ve just recently started touching C code a little bit more often, what would it take to make this library thread safe? Is it shared memory or other state/variables across function calls or is it some weird C-specific memory thing?
Well, the documentation seems to suggest that calculated values are stored in global state, so that is likely at least one thing that might lead to threading being unsafe.
I wonder what make it says that “GMP MP cannot be used for robust programs.”
[Comment removed by author]
I couldn’t find an area in the library where exit was called. Procedure
apt-get source libgmp10
# exclude standalone tests, demos, tools for generating data and performance testing
grep --include="*.c" -iR exit | grep -v test | grep -v demos | grep -v gen | grep -v tune
Maybe it’s hidden as an abort() or something?
I’d consider judicious use of abort() to be a feature not a bug. Robust software isn’t software that continues running no matter what. If an error occurs it’s best to return it, but if an essential pre or post condition is violated, signalling BUG via abort() seems like a good idea.
I’m skeptical. libgmp is used by a lot of software, and searching didn’t turn up any results of that being a problem for anybody.
Even if it were a problem, it would have been better to submit a patch than to write a new incompatible library, IMO.
Do you know why exit is called at all? I’m asking out of curiosity.