Assembler code and multithreading

Question:

Good day everyone!
A binary library of some computational functions written in assembler is given, there are no source codes, as a result, there is no deep understanding of the internals of these functions either. There is the next theoretical question: is it possible to safely use these functions in a multithreaded application? I understand that it is possible to "restrict" all calls from this library to mutexes, but I am not sure that they will not conflict with other application functions, for example, malloc (). Allow my doubts pliz.

Answer:

In general, such a library can cost you sleepless nights spent debugging. I do not recommend it for use. If I understand anything at all, then even critical sections will not really help. Depends on whether a separate copy of the library is created for each thread. I am personally sure not. And if so, then some clever function that modifies the internal variables of the library and tied to their values, called several times from different threads, will completely break the logic of the library.

Scroll to Top