Previous: Internal representation of LOGICAL variables, Up: Compiler Characteristics

5.3 Thread-safety of the runtime library

GNU Fortran can be used in programs with multiple threads, e.g. by using OpenMP, by calling OS thread handling functions via the ISO_C_BINDING facility, or by GNU Fortran compiled library code being called from a multi-threaded program.

The GNU Fortran runtime library, (libgfortran), supports being called concurrently from multiple threads with the following exceptions.

During library initialization, the C getenv function is used, which need not be thread-safe. Similarly, the getenv function is used to implement the GET_ENVIRONMENT_VARIABLE and GETENV intrinsics. It is the responsibility of the user to ensure that the environment is not being updated concurrently when any of these actions are taking place.

The EXECUTE_COMMAND_LINE and SYSTEM intrinsics are implemented with the system function, which need not be thread-safe. It is the responsibility of the user to ensure that system is not called concurrently.

Finally, for platforms not supporting thread-safe POSIX functions, further functionality might not be thread-safe. For details, please consult the documentation for your operating system.