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

Last change on this file since 3793 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
Line 
1!> @posix_calls_from_fortran.f90
2!------------------------------------------------------------------------------!
3! This file is part of the PALM model system.
4!
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.
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!
14! You should have received a copy of the GNU General Public License along with
15! PALM. If not, see <http://www.gnu.org/licenses/>.
16!
17! Copyright 1997-2019 Leibniz Universitaet Hannover
18!------------------------------------------------------------------------------!
19!
20! Current revisions:
21! -----------------
22!
23!
24! Former revisions:
25! -----------------
26! $Id: posix_calls_from_fortran.f90 2696 2017-12-14 17:12:51Z kanani $
27! add variable description
28!
29! 2696 2017-12-14 17:12:51Z kanani
30! Corrected "Former revisions" section
31!
32! 2696 2017-12-14 17:12:51Z kanani
33! Change in file header (GPL part)
34!
35! 1986 2016-08-10 14:07:17Z gronemeier
36! Forced header and separation lines into 80 columns
37!
38! 1986 2016-08-10 14:07:17Z gronemeier
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
55!
56!--    Sleep function from C library
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!------------------------------------------------------------------------------!
79 SUBROUTINE fortran_sleep( seconds )
80
81    INTEGER, INTENT(IN) ::  seconds             !< seconds to wait
82
83    INTEGER(c_int)      ::  seconds_in_c        !< same as seconds
84    INTEGER(c_int)      ::  sleep_return_value  !< returned value to sleep
85
86    seconds_in_c = seconds
87
88    sleep_return_value = fsleep( seconds_in_c )
89
90 END SUBROUTINE fortran_sleep
91
92 END MODULE posix_calls_from_fortran
Note: See TracBrowser for help on using the repository browser.