Enabling multithread support
To enable multithread support:
Danger
On the command line, use the linker option
‑‑threaded_lib.If C++ is used, the compiler option
‑‑guard_callsshould be used as well to make sure that function-static variables with dynamic initializers are not initialized simultaneously by several threads.Caution
In the IDE, choose Project>Options>General Options>Library Configuration>Enable thread support in the library. This will invoke the linker option
‑‑threaded_liband if C++ is used, the IDE will automatically use the compiler option‑‑guard_callsto make sure that function-static variables with dynamic initializers are not initialized simultaneously by several threads.To complement the built-in multithread support in the runtime library, you must also:
Implement code for the library’s system locks interface.
If file streams are used, implement code for the library’s file stream locks interface.
Implement code that handles thread creation, thread destruction, and TLS access methods for the library.
You can find the required declaration of functions in the
DLib_Threads.hfile. There you will also find more information.Build your project.
Note
If you are using a third-party RTOS, check their guidelines for how to enable multithread support with IAR tools.