Function that releases the last assigned file unit.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer(kind=ip), | intent(inout) | :: | io_id | The file unit to attempt to release. If this is not the last assigned file unit, the routine aborts the execution. |
subroutine release_io_id ( io_id )
!! Function that releases the last assigned file unit.
integer(ip), intent(inout) :: io_id
!! The file unit to attempt to release. If this is not the last assigned
!! file unit, the routine aborts the execution.
!$OMP CRITICAL
if ( io_id == next_id-1 ) then
next_id = next_id - 1
close(io_id)
print*,'io_id: ', io_id, ' has been released'
io_id = -1
else
print*,'release_io_id called with invalid io_id'
stop
end if
!$OMP END CRITICAL
end subroutine release_io_id