Intel® Fortran Compiler 16.0 User and Reference Guide

FOR_SET_REENTRANCY

Run-Time Function: Controls the type of reentrancy protection that the Fortran Run-Time 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 Run-Time 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