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

Last change on this file since 4649 was 4649, checked in by raasch, 4 years ago

files re-formatted to follow the PALM coding standard

File size: 2.9 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 terms of the GNU General
6! Public License as published by the Free Software Foundation, either version 3 of the License, or
7! (at your option) any later version.
8!
9! PALM is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
10! implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
11! Public License for more details.
12!
13! You should have received a copy of the GNU General Public License along with PALM. If not, see
14! <http://www.gnu.org/licenses/>.
15!
16! Copyright 1997-2020 Leibniz Universitaet Hannover
17!--------------------------------------------------------------------------------------------------!
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! File re-formatted to follow the PALM coding standard
28!
29!
30! 2696 2017-12-14 17:12:51Z kanani
31! Corrected "Former revisions" section
32!
33! 2696 2017-12-14 17:12:51Z kanani
34! Add variable description
35!
36! 1986 2016-08-10 14:07:17Z gronemeier
37! Initial revision
38!
39!--------------------------------------------------------------------------------------------------!
40! Description:
41! ------------
42!> Collection of POSIX-command calls for Fortran
43!--------------------------------------------------------------------------------------------------!
44 MODULE posix_calls_from_fortran
45
46    USE, INTRINSIC ::  iso_c_binding,                                                              &
47        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.