Good day to all!
There is a library binary of some computational functions written in an assembler, there are no source codes, as a result, there is also no deep understanding of the internals of these functions. There is the following theoretical question: is it possible to safely use these functions in a multi-threaded application? I understand that you can "restrict" all calls from this library to mutexes, but there is no certainty that they will not conflict with other functions of the application, for example, with malloc (). Solve my doubts pliz.
Good day to all!
In general, such a library can cost you sleepless nights spent on debugging. I do not recommend to use. If I understand anything at all, then even critical sections will not really help. It depends on whether a separate copy of the library is created for each stream. I personally believe that no. And if so, then some tricky f-tion, modifying the internal variables of the library and tied to their values, caused several times from different threads, completely violate the logic of the library.
There is the following theoretical question: is it possible to safely use these functions in a multi-threaded application?
The probability, of course, is. But I'm afraid they are less than 100%
If you mean that for some sections of the application there is no simultaneous, parallel access, then you can use such a tool as critical sections . Critical sections are objects used to block access of all threads (threads) of an application, except one, to some important data at one time. They will secure the program from simultaneous access to some of its sections of code. The tool is extremely easy to use.