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

Last change on this file since 4180 was 4180, checked in by scharf, 22 months ago

removed comments in 'Former revisions' section that are older than 01.01.2019

File size: 2.3 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!
30! Description:
31! ------------
32!> Collection of POSIX-command calls for Fortran
33!------------------------------------------------------------------------------!
34 MODULE posix_calls_from_fortran
35
36    USE, INTRINSIC ::  iso_c_binding, ONLY: c_int
37
38    IMPLICIT none
39
40    PRIVATE
41
42
43    INTERFACE
44!
45!--    Sleep function from C library
46       FUNCTION fsleep( seconds )  BIND( C, NAME='sleep' )
47          IMPORT
48          INTEGER(c_int) ::  fsleep
49          INTEGER(c_int), INTENT(IN), VALUE ::  seconds
50       END FUNCTION fsleep
51
52    END INTERFACE
53
54    INTERFACE fortran_sleep
55       MODULE PROCEDURE fortran_sleep
56    END INTERFACE fortran_sleep
57
58    PUBLIC fortran_sleep
59
60
61 CONTAINS
62
63!------------------------------------------------------------------------------!
64! Description:
65! ------------
66!> Wait a specified amount of seconds
67!------------------------------------------------------------------------------!
68 SUBROUTINE fortran_sleep( seconds )
69
70    INTEGER, INTENT(IN) ::  seconds             !< seconds to wait
71
72    INTEGER(c_int)      ::  seconds_in_c        !< same as seconds
73    INTEGER(c_int)      ::  sleep_return_value  !< returned value to sleep
74
75    seconds_in_c = seconds
76
77    sleep_return_value = fsleep( seconds_in_c )
78
79 END SUBROUTINE fortran_sleep
80
81 END MODULE posix_calls_from_fortran
Note: See TracBrowser for help on using the repository browser.