Skip to main content

IAR Embedded Workbench for RH850 3.20.x

Multithread support in the DLIB runtime environment

In this section:

The DLIB runtime environment uses two kinds of locks—system locks and file stream locks. The file stream locks are used as guards when the state of a file stream is updated, and are only needed in the Full library configuration. The following objects are guarded with system locks:

  • The heap (in other words when malloc, new, free, delete, realloc, or calloc is used).

  • The C file system (only available in the Full library configuration), but not the file streams themselves. The file system is updated when a stream is opened or closed, in other words when fopen, fclose, fdopen, fflush, or freopen is used.

  • The signal system (in other words when signal is used).

  • The temporary file system (in other words when tmpnam is used).

  • C++ dynamically initialized function-local objects with static storage duration.

  • C++ locale facet handling

  • C++ regular expression handling

  • C++ terminate and unexpected handling

These library objects use TLS:

Library objects using TLS

When these functions are used

Error functions

errno, strerror

Table 63. Library objects using TLS 


Note

If you are using printf/scanf (or any variants) with formatters, each individual formatter will be guarded, but the complete printf/scanf invocation will not be guarded.

If C++ is used in a runtime environment with multithread support, the compiler option ‑‑guard_calls must be used to make sure that function-static variables with dynamic initializers are not initialized simultaneously by several threads.