source: palm/trunk/SOURCE/posix_calls_from_fortran.f90 @ 3662

Last change on this file since 3662 was 3655, checked in by knoop, 6 years ago

Bugfix: made "unit" and "found" intend INOUT in module interface subroutines + automatic copyright update

File size: 2.6 KB
RevLine 
[1987]1!> @posix_calls_from_fortran.f90
[2000]2!------------------------------------------------------------------------------!
[2696]3! This file is part of the PALM model system.
[1987]4!
[2000]5! PALM is free software: you can redistribute it and/or modify it under the
6! terms of the GNU General Public License as published by the Free Software
7! Foundation, either version 3 of the License, or (at your option) any later
8! version.
[1987]9!
10! PALM is distributed in the hope that it will be useful, but WITHOUT ANY
11! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
12! A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
13!
[2696]14! You should have received a copy of the GNU General Public License along with
[1987]15! PALM. If not, see <http://www.gnu.org/licenses/>.
16!
[3655]17! Copyright 1997-2019 Leibniz Universitaet Hannover
[2000]18!------------------------------------------------------------------------------!
[1987]19!
20! Current revisions:
21! -----------------
22!
[2001]23!
[1987]24! Former revisions:
25! -----------------
[2716]26! $Id: posix_calls_from_fortran.f90 2696 2017-12-14 17:12:51Z kanani $
[3554]27! add variable description
28!
29! 2696 2017-12-14 17:12:51Z kanani
[2716]30! Corrected "Former revisions" section
31!
32! 2696 2017-12-14 17:12:51Z kanani
33! Change in file header (GPL part)
[1987]34!
35! 1986 2016-08-10 14:07:17Z gronemeier
[2001]36! Forced header and separation lines into 80 columns
37!
38! 1986 2016-08-10 14:07:17Z gronemeier
[1987]39! Initial revision
40!
41! Description:
42! ------------
43!> Collection of POSIX-command calls for Fortran
44!------------------------------------------------------------------------------!
45 MODULE posix_calls_from_fortran
46
47    USE, INTRINSIC ::  iso_c_binding, ONLY: c_int
48
49    IMPLICIT none
50
51    PRIVATE
52
53
54    INTERFACE
[3554]55!
56!--    Sleep function from C library
[1987]57       FUNCTION fsleep( seconds )  BIND( C, NAME='sleep' )
58          IMPORT
59          INTEGER(c_int) ::  fsleep
60          INTEGER(c_int), INTENT(IN), VALUE ::  seconds
61       END FUNCTION fsleep
62
63    END INTERFACE
64
65    INTERFACE fortran_sleep
66       MODULE PROCEDURE fortran_sleep
67    END INTERFACE fortran_sleep
68
69    PUBLIC fortran_sleep
70
71
72 CONTAINS
73
74!------------------------------------------------------------------------------!
75! Description:
76! ------------
77!> Wait a specified amount of seconds
78!------------------------------------------------------------------------------!
[3554]79 SUBROUTINE fortran_sleep( seconds )
[1987]80
[3554]81    INTEGER, INTENT(IN) ::  seconds             !< seconds to wait
[1987]82
[3554]83    INTEGER(c_int)      ::  seconds_in_c        !< same as seconds
84    INTEGER(c_int)      ::  sleep_return_value  !< returned value to sleep
[1987]85
[3554]86    seconds_in_c = seconds
[1987]87
[3554]88    sleep_return_value = fsleep( seconds_in_c )
[1987]89
[3554]90 END SUBROUTINE fortran_sleep
[1987]91
92 END MODULE posix_calls_from_fortran
Note: See TracBrowser for help on using the repository browser.