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.
© Free Software Foundation
Licensed under the GNU Free Documentation License, Version 1.3.
https://gcc.gnu.org/onlinedocs/gcc-4.9.3/gfortran/Thread_002dsafety-of-the-runtime-library.html