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

Last change on this file since 2481 was 2101, checked in by suehring, 8 years ago

last commit documented

File size: 2.4 KB
Line 
1!> @posix_calls_from_fortran.f90
2!------------------------------------------------------------------------------!
3! This file is part of PALM.
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 fGeneral Public License along with
15! PALM. If not, see <http://www.gnu.org/licenses/>.
16!
17! Copyright 1997-2017 Leibniz Universitaet Hannover
18!------------------------------------------------------------------------------!
19!
20! Current revisions:
21! -----------------
22!
23!
24! Former revisions:
25! -----------------
26! $Id: posix_calls_from_fortran.f90 1986 2016-08-10 14:07:17Z gronemeier $
27!
28! 1986 2016-08-10 14:07:17Z gronemeier
29! Forced header and separation lines into 80 columns
30!
31! 1986 2016-08-10 14:07:17Z gronemeier
32! Initial revision
33!
34! Description:
35! ------------
36!> Collection of POSIX-command calls for Fortran
37!------------------------------------------------------------------------------!
38 MODULE posix_calls_from_fortran
39
40    USE, INTRINSIC ::  iso_c_binding, ONLY: c_int
41
42    IMPLICIT none
43
44    PRIVATE
45
46
47    INTERFACE
48
49       FUNCTION fsleep( seconds )  BIND( C, NAME='sleep' )
50          IMPORT
51          INTEGER(c_int) ::  fsleep
52          INTEGER(c_int), INTENT(IN), VALUE ::  seconds
53       END FUNCTION fsleep
54
55    END INTERFACE
56
57    INTERFACE fortran_sleep
58       MODULE PROCEDURE fortran_sleep
59    END INTERFACE fortran_sleep
60
61    PUBLIC fortran_sleep
62
63
64 CONTAINS
65
66!------------------------------------------------------------------------------!
67! Description:
68! ------------
69!> Wait a specified amount of seconds
70!------------------------------------------------------------------------------!
71    SUBROUTINE fortran_sleep( seconds )
72
73       INTEGER, INTENT(IN) ::  seconds
74
75       INTEGER(c_int)      ::  seconds_in_c
76       INTEGER(c_int)      ::  sleep_return_value
77
78       seconds_in_c = seconds
79
80       sleep_return_value = fsleep( seconds_in_c )
81
82   END SUBROUTINE fortran_sleep
83
84 END MODULE posix_calls_from_fortran
85
Note: See TracBrowser for help on using the repository browser.