MONC
forthread_data.F90
Go to the documentation of this file.
2  use iso_c_binding
4  implicit none
5 
6  abstract interface
7  subroutine i_run(arg)
8  integer :: arg
9  end subroutine i_run
10  end interface
11 
12  abstract interface
13  subroutine i_once() bind(c)
14  end subroutine i_once
15  end interface
16 
17  abstract interface
18  subroutine i_destructor(arg) bind(c)
19  use iso_c_binding
20  integer(c_int) :: arg
21  end subroutine i_destructor
22  end interface
23 
24  type t_run
25  procedure(i_run), pointer, nopass :: run
26  integer, pointer :: arg
27  end type t_run
28 
29  type ptr_t_run
30  type(t_run), pointer :: t => null()
31  end type ptr_t_run
32 
33  integer, parameter :: init_size = 16
34  type(ptr_t_run), dimension(:), pointer :: routine_table => null()
35  integer :: routine_table_size
37 contains
38 
39  ! the return value still needs work to be done
40  ! currently the start_routine cannot return any value.
41  ! This should be handled similarly to thread_exit
42  type(c_ptr) function start_routine(arg) bind(c)
43 
44  type(c_ptr), value, intent(in) :: arg
45  !returns?
46 
47  type(t_run), pointer :: exec
48  integer,pointer :: ret
49 
50  call c_f_pointer(arg,exec)
51  call exec%run(exec%arg)
52  start_routine = c_null_ptr
53  end function start_routine
54 end module forthread_data
forthread_data::i_once
Definition: forthread_data.F90:13
forthread_data::init_size
integer, parameter init_size
Definition: forthread_data.F90:33
forthread_data::i_run
Definition: forthread_data.F90:7
forthread_data
Definition: forthread_data.F90:1
forthread_data::ptr_t_run
Definition: forthread_data.F90:29
forthread_ciface_mod
Definition: forthread_ciface.F90:1
forthread_data::routine_table_mutex
integer routine_table_mutex
Definition: forthread_data.F90:36
forthread_data::t_run
Definition: forthread_data.F90:24
forthread_data::routine_table_size
integer routine_table_size
Definition: forthread_data.F90:35
forthread_data::i_destructor
Definition: forthread_data.F90:18
forthread_data::routine_table
type(ptr_t_run), dimension(:), pointer routine_table
Definition: forthread_data.F90:34
forthread_data::start_routine
type(c_ptr) function start_routine(arg)
Definition: forthread_data.F90:43