Skip to content

Commit 4df7434

Browse files
committed
Updated dummy argument.
1 parent d39d8dd commit 4df7434

File tree

4 files changed

+9
-6
lines changed

4 files changed

+9
-6
lines changed

examples/mutex/mutex.f90

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,9 @@ program main
3636
integer, parameter :: NTHREADS = 16
3737

3838
integer :: i, stat
39-
type(c_pthread_t) :: threads(NTHREADS)
4039
integer, target :: routines(NTHREADS) = [ (i, i = 1, NTHREADS) ]
40+
type(c_pthread_t) :: threads(NTHREADS)
41+
type(c_ptr) :: ptr
4142

4243
stat = c_pthread_mutex_init(mutex_sample, c_null_ptr)
4344

@@ -53,7 +54,7 @@ program main
5354
print '("Joining threads ...")'
5455

5556
do i = 1, NTHREADS
56-
stat = c_pthread_join(threads(i), c_loc(routines(i)))
57+
stat = c_pthread_join(threads(i), ptr)
5758
end do
5859

5960
stat = c_pthread_mutex_destroy(mutex_sample)

examples/pthread/pthread.f90

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@ program main
1010
integer, parameter :: NTHREADS = 3
1111

1212
integer :: i, stat
13-
type(c_pthread_t) :: threads(NTHREADS)
1413
integer, target :: routines(NTHREADS) = [ (i, i = 1, NTHREADS) ]
14+
type(c_pthread_t) :: threads(NTHREADS)
15+
type(c_ptr) :: ptr
1516

1617
print '("Starting threads ...")'
1718

@@ -25,7 +26,7 @@ program main
2526
print '("Joining threads ...")'
2627

2728
do i = 1, NTHREADS
28-
stat = c_pthread_join(threads(i), c_loc(routines(i)))
29+
stat = c_pthread_join(threads(i), ptr)
2930
end do
3031
contains
3132
recursive subroutine hello(arg) bind(c)

examples/semaphore/semaphore.f90

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ program main
1515
type(c_funptr) :: procs(NTHREADS)
1616
type(c_pthread_t) :: threads(NTHREADS)
1717
type(c_sem_t), target :: sem
18+
type(c_ptr) :: ptr
1819

1920
integer :: i, stat
2021
integer, target :: routines(NTHREADS) = [ (i, i = 1, NTHREADS) ]
@@ -38,7 +39,7 @@ program main
3839
print '("--- Joining threads ...")'
3940

4041
do i = 1, NTHREADS
41-
stat = c_pthread_join(threads(i), c_loc(routines(i)))
42+
stat = c_pthread_join(threads(i), ptr)
4243
end do
4344

4445
stat = c_sem_destroy(sem)

src/unix_pthread.F90

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ function c_pthread_join(thread, value_ptr) bind(c, name='pthread_join')
6565
import :: c_int, c_ptr, c_pthread_t
6666
implicit none
6767
type(c_pthread_t), intent(in), value :: thread
68-
type(c_ptr), intent(in) :: value_ptr
68+
type(c_ptr), intent(out) :: value_ptr
6969
integer(kind=c_int) :: c_pthread_join
7070
end function c_pthread_join
7171

0 commit comments

Comments
 (0)