Intel® Fortran Compiler Classic and Intel® Fortran Compiler Developer Guide and Reference

ID 767251
Date 7/13/2023
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

FOR_SET_REENTRANCY

Runtime Function: Controls the type of reentrancy protection that the Fortran Runtime Library (RTL) exhibits. This routine can be called from a C or Fortran program.

Module

USE IFCORE

result = FOR_SET_REENTRANCY (mode)

mode

Must be of type INTEGER(4) and contain one of the following options:

FOR_K_REENTRANCY_NONE

Tells the Fortran RTL to perform simple locking around critical sections of RTL code. This type of reentrancy should be used when the Fortran RTL will not be reentered due to asynchronous system traps (ASTs) or threads within the application.

FOR_K_REENTRANCY_ASYNCH

Tells the Fortran RTL to perform simple locking and disables ASTs around critical sections of RTL code. This type of reentrancy should be used when the application contains AST handlers that call the Fortran RTL.

FOR_K_REENTRANCY_THREADED

Tells the Fortran RTL to perform thread locking. This type of reentrancy should be used in multithreaded applications.

FOR_K_REENTRANCY_INFO

Tells the Fortran RTL to return the current reentrancy mode.

Results

The result type is INTEGER(4). The return value represents the previous setting of the Fortran Runtime Library reentrancy mode, unless the argument is FOR_K_REENTRANCY_INFO, in which case the return value represents the current setting.

You must be using an RTL that supports the level of reentrancy you desire. For example, FOR_SET_REENTRANCY ignores a request for thread protection (FOR_K_REENTRANCY_THREADED) if you do not build your program with the thread-safe RTL.

Example

  PROGRAM SETREENT
  USE IFCORE
  INTEGER*4    MODE
  CHARACTER*10 REENT_TXT(3) /'NONE    ','ASYNCH  ','THREADED'/
  PRINT*,'Setting Reentrancy mode to ',REENT_TXT(MODE+1)
  MODE = FOR_SET_REENTRANCY(FOR_K_REENTRANCY_NONE)
  PRINT*,'Previous Reentrancy mode was ',REENT_TXT(MODE+1)
  MODE = FOR_SET_REENTRANCY(FOR_K_REENTRANCY_INFO)
  PRINT*,'Current Reentrancy mode is ',REENT_TXT(MODE+1)
  END