MONC
forthread.F90
Go to the documentation of this file.
2  use iso_c_binding
6  implicit none
7 
8 contains
9 
10  integer function forthread_init()
11  integer :: info
12 
13  allocate(routine_table(init_size))
15 
16  call thread_init(info)
17 
19  forthread_init=info
20  end function forthread_init
21 
22  integer function forthread_destroy()
23  integer :: info
24 
25  deallocate(routine_table)
28  call thread_destroy(info)
30  end function forthread_destroy
31 
32  integer function forthread_create(thread_id,attr_id,run,arg)
33  integer, intent(out) :: thread_id
34  integer, intent(in) :: attr_id
35  procedure(i_run) :: run !type i_run
36  integer, target :: arg
37 
38  integer :: i, info
39  procedure(i_start_routine), bind(c), pointer :: start_routinep
40  type(ptr_t_run), dimension(:), pointer :: tmp
41  type(t_run), pointer :: runp
43 
44  call thread_alloc(thread_id,info)
45  if (thread_id.gt.routine_table_size) then
46  nullify(tmp)
47  allocate(tmp(routine_table_size*2))
48  do i=1,routine_table_size
49  tmp(i) = routine_table(i)
50  enddo
51  deallocate(routine_table)
52  routine_table => tmp
54  endif
55  allocate(routine_table(thread_id)%t)
56  routine_table(thread_id)%t%run => run
57  routine_table(thread_id)%t%arg => arg
58  start_routinep => start_routine
59 
60  call thread_create(thread_id,attr_id,c_funloc(start_routinep),&
61  c_loc(routine_table(thread_id)%t),info)
62 
64  forthread_create=info
65  end function forthread_create
66 
67  integer function forthread_detach(thread_id)
68  integer, intent(in) :: thread_id
69 
70  integer :: info
71 
72  call thread_detach(thread_id,info)
73  forthread_detach=info
74  end function forthread_detach
75 
76  integer function forthread_equal(t1,t2)
77  integer, intent(in) :: t1, t2
78 
79  integer :: info
80 
81  call thread_equal(t1,t2,info)
82  forthread_equal=info
83  end function forthread_equal
84 
85  ! Exits the current thread
86  subroutine forthread_exit(val)
87  integer, pointer :: val
88 
89  call thread_exit(c_loc(val))
90  end subroutine forthread_exit
91 
92  integer function forthread_join(thread_id,val)
93  integer, intent(in) :: thread_id
94  integer, pointer:: val
95 
96  integer :: info
97 
98  type(c_ptr) :: value_ptr
99  call thread_join(thread_id,value_ptr,info)
100  call c_f_pointer(value_ptr,val)
101  forthread_join=info
102  end function forthread_join
103 
104  integer function forthread_cancel(thread_id)
105  integer, intent(in) :: thread_id
106 
107  integer :: info
108 
109  call thread_cancel(thread_id,info)
110  forthread_cancel=info
111  end function forthread_cancel
112 
113  integer function forthread_kill(thread_id,sig)
114  integer, intent(in) :: thread_id, sig
115 
116  integer :: info
117 
118  call thread_kill(thread_id,sig,info)
119  forthread_kill=info
120  end function forthread_kill
121 
122  integer function forthread_once_init(once_ctrl_id)
123  integer, intent(out) :: once_ctrl_id
124 
125  integer :: info
126 
127  call thread_once_init(once_ctrl_id,info)
129  end function forthread_once_init
130 
131  integer function forthread_once(once_ctrl_id,init_routine)
132  integer, intent(in) :: once_ctrl_id
133  procedure(i_once) :: init_routine
134  ! dangerous but works! (gfortran)
135  ! TODO test in other compilers
136 
137  integer :: info
138 
139  call thread_once(once_ctrl_id,c_funloc(init_routine),info)
140  forthread_once=info
141  end function forthread_once
142 
143  ! TODO implement thread_atfork
144 
145  integer function forthread_getconcurrency(currlevel)
146  integer, intent(out) :: currlevel
147 
148  integer :: info
149 
150  call thread_getconcurrency(currlevel,info)
152  end function forthread_getconcurrency
153 
154  integer function forthread_setconcurrency(newlevel)
155  integer, intent(in) :: newlevel
156 
157  integer :: info
158 
159  call thread_setconcurrency(newlevel,info)
161  end function forthread_setconcurrency
162 
163 #ifndef __DARWIN
164  integer function forthread_getcpuclockid(thread,clock_id)
165  integer, intent(in) :: thread
166  integer, intent(out) :: clock_id
167 
168  integer :: info
169 
170  call thread_getcpuclockid(thread,clock_id,info)
172  end function forthread_getcpuclockid
173 #endif
174 
175  integer function forthread_getschedparam(thread,policy,param)
176  integer, intent(in) :: thread
177  integer, intent(out) :: policy
178  type(sched_param), intent(out) :: param
179 
180  integer :: info
181 
182  call thread_getschedparam(thread,policy,param,info)
184  end function forthread_getschedparam
185 
186  integer function forthread_setschedparam(thread,policy,param)
187  integer, intent(in) :: thread, policy
188  type(sched_param), intent(in) :: param
189 
190  integer :: info
191 
192  call thread_setschedparam(thread,policy,param,info)
194  end function forthread_setschedparam
195 
196 #ifndef __DARWIN
197  integer function forthread_setschedprio(thread,prio)
198  integer, intent(in) :: thread, prio
199 
200  integer :: info
201 
202  call thread_setschedprio(thread,prio,info)
204  end function forthread_setschedprio
205 #endif
206 
207  integer function forthread_setcancelstate(state,oldstate)
208  integer, intent(in) :: state
209  integer, intent(out) :: oldstate
210 
211  integer :: info
212 
213  call thread_setcancelstate(state,oldstate,info)
215  end function forthread_setcancelstate
216 
217  integer function forthread_setcanceltype(ctype,oldctype)
218  integer, intent(in) :: ctype
219  integer, intent(out) :: oldctype
220 
221  integer :: info
222 
223  call thread_setcanceltype(ctype,oldctype,info)
225  end function forthread_setcanceltype
226 
227  !*****************************************!
228  !* sharing private data in threads *!
229  !*****************************************!
230 
231  integer function forthread_key_delete(key_id)
232  integer, intent(in) :: key_id
233 
234  integer :: info
235 
236  call thread_key_delete(key_id,info)
238  end function forthread_key_delete
239 
240  integer function forthread_key_create(key_id,destructor)
241  integer, intent(out) :: key_id
242  procedure(i_destructor) :: destructor
243  ! dangerous but works! (gfortran)
244  ! TODO test in other compilers
245 
246  integer :: info
247 
248  call thread_key_create(key_id,c_funloc(destructor),info)
250  end function forthread_key_create
251 
252  ! no wrappers provided for the following two routines
253  !void thread_getspecific(int *key, void **value, int *info);
254 
255  !void thread_setspecific(int *key, void **value, int *info);
256 
257 
258 
259  !*****************************************!
260  !* mutex routines *!
261  !*****************************************!
262 
263 
264  integer function forthread_mutex_destroy(mutex_id)
265  integer, intent(in) :: mutex_id
266 
267  integer :: info
268 
269  call thread_mutex_destroy(mutex_id,info)
271  end function forthread_mutex_destroy
272 
273  integer function forthread_mutex_init(mutex_id,attr_id)
274  integer, intent(out) :: mutex_id
275  integer, intent(in) :: attr_id
276 
277  integer :: info
278 
279  call thread_mutex_init(mutex_id,attr_id,info)
281  end function forthread_mutex_init
282 
283  integer function forthread_mutex_lock(mutex_id)
284  integer, intent(in) :: mutex_id
285 
286  integer :: info
287 
288  call thread_mutex_lock(mutex_id,info)
290  end function forthread_mutex_lock
291 
292  integer function forthread_mutex_trylock(mutex_id)
293  integer, intent(in) :: mutex_id
294 
295  integer :: info
296 
297  call thread_mutex_trylock(mutex_id,info)
299  end function forthread_mutex_trylock
300 
301  integer function forthread_mutex_unlock(mutex_id)
302  integer, intent(in) :: mutex_id
303 
304  integer :: info
305 
306  call thread_mutex_unlock(mutex_id,info)
308  end function forthread_mutex_unlock
309 
310  integer function forthread_mutex_getprioceiling(mutex,prioceiling)
311  integer, intent(in) :: mutex
312  integer, intent(out) :: prioceiling
313 
314  integer :: info
315 
316  call thread_mutex_getprioceiling(mutex,prioceiling,info)
318  end function forthread_mutex_getprioceiling
319 
320  integer function forthread_mutex_setprioceiling(mutex,prioceiling,old_ceiling)
321  integer, intent(in) :: mutex, prioceiling
322  integer, intent(out) :: old_ceiling
323 
324  integer :: info
325 
326  call thread_mutex_setprioceiling(mutex,prioceiling,old_ceiling,info)
328  end function forthread_mutex_setprioceiling
329 
330 #ifndef __DARWIN
331  integer function forthread_mutex_timedlock(mutex,abs_timeout)
332  integer, intent(in) :: mutex
333  type(timespec), intent(in) :: abs_timeout
334 
335  integer :: info
336 
337  call thread_mutex_timedlock(mutex,abs_timeout,info)
339  end function forthread_mutex_timedlock
340 #endif
341 
342  !*****************************************!
343  !* condition variable routines *!
344  !*****************************************!
345 
346  integer function forthread_cond_destroy(cond_id)
347  integer, intent(in) :: cond_id
348 
349  integer :: info
350 
351  call thread_cond_destroy(cond_id,info)
353  end function forthread_cond_destroy
354 
355  integer function forthread_cond_init(cond_id,attr_id)
356  integer, intent(out) :: cond_id
357  integer, intent(in) :: attr_id
358 
359  integer :: info
360 
361  call thread_cond_init(cond_id,attr_id,info)
363  end function forthread_cond_init
364 
365  integer function forthread_cond_timedwait(mutex,abstime)
366  integer, intent(in) :: mutex
367  type(timespec), intent(in) :: abstime
368 
369  integer :: info
370 
371  call thread_cond_timedwait(mutex,abstime,info)
373  end function forthread_cond_timedwait
374 
375  integer function forthread_cond_wait(cond_id,mutex_id)
376  integer, intent(in) :: cond_id, mutex_id
377 
378  integer :: info
379 
380  call thread_cond_wait(cond_id,mutex_id,info)
382  end function forthread_cond_wait
383 
384  integer function forthread_cond_broadcast(cond_id)
385  integer, intent(in) :: cond_id
386 
387  integer :: info
388 
389  call thread_cond_broadcast(cond_id,info)
391  end function forthread_cond_broadcast
392 
393  integer function forthread_cond_signal(cond_id)
394  integer, intent(in) :: cond_id
395 
396  integer :: info
397 
398  call thread_cond_signal(cond_id,info)
400  end function forthread_cond_signal
401 
402 #ifndef __DARWIN
403  !****************************************!
404  !* barrier variable routines *!
405  !****************************************!
406 
407  integer function forthread_barrier_destroy(barrier_id)
408  integer, intent(in) :: barrier_id
409 
410  integer :: info
411 
412  call thread_barrier_destroy(barrier_id,info)
414  end function forthread_barrier_destroy
415 
416  integer function forthread_barrier_init(barrier_id,attr_id,tcount)
417  integer, intent(out) :: barrier_id
418  integer, intent(in) :: attr_id, tcount
419 
420  integer :: info
421 
422  call thread_barrier_init(barrier_id,attr_id,tcount,info)
424  end function forthread_barrier_init
425 
426  integer function forthread_barrier_wait(barrier_id)
427  integer, intent(in) :: barrier_id
428 
429  integer :: info
430 
431  call thread_barrier_wait(barrier_id,info)
433  end function forthread_barrier_wait
434 
435 
436  !*************************************!
437  !* spin variable routines *!
438  !*************************************!
439 
440 
441  integer function forthread_spin_destroy(spinlock_id)
442  integer, intent(in) :: spinlock_id
443 
444  integer :: info
445 
446  call thread_spin_destroy(spinlock_id,info)
448  end function forthread_spin_destroy
449 
450  integer function forthread_spin_init(spinlock_id,pshared)
451  integer, intent(out) :: spinlock_id
452  integer, intent(in) :: pshared
453 
454  integer :: info
455 
456  call thread_spin_init(spinlock_id,pshared,info)
458  end function forthread_spin_init
459 
460  integer function forthread_spin_lock(lock_id)
461  integer, intent(in) :: lock_id
462 
463  integer :: info
464 
465  call thread_spin_lock(lock_id,info)
467  end function forthread_spin_lock
468 
469  integer function forthread_spin_trylock(lock_id)
470  integer, intent(in) :: lock_id
471 
472  integer :: info
473 
474  call thread_spin_trylock(lock_id,info)
476  end function forthread_spin_trylock
477 
478  integer function forthread_spin_unlock(lock_id)
479  integer, intent(in) :: lock_id
480 
481  integer :: info
482 
483  call thread_spin_unlock(lock_id,info)
485  end function forthread_spin_unlock
486 
487 #endif
488 
489  !*************************************!
490  !* rwlock variable routines *!
491  !*************************************!
492 
493 
494  integer function forthread_rwlock_destroy(rwlock_id)
495  integer, intent(in) :: rwlock_id
496 
497  integer :: info
498 
499  call thread_rwlock_destroy(rwlock_id,info)
501  end function forthread_rwlock_destroy
502 
503  integer function forthread_rwlock_init(rwlock_id,attr_id)
504  integer, intent(out) :: rwlock_id
505  integer, intent(in) :: attr_id
506 
507  integer :: info
508 
509  call thread_rwlock_init(rwlock_id,attr_id,info)
511  end function forthread_rwlock_init
512 
513  integer function forthread_rwlock_rdlock(lock_id)
514  integer, intent(in) :: lock_id
515 
516  integer :: info
517 
518  call thread_rwlock_rdlock(lock_id,info)
520  end function forthread_rwlock_rdlock
521 
522  integer function forthread_rwlock_tryrdlock(lock_id)
523  integer, intent(in) :: lock_id
524 
525  integer :: info
526 
527  call thread_rwlock_tryrdlock(lock_id,info)
529  end function forthread_rwlock_tryrdlock
530 
531  integer function forthread_rwlock_wrlock(lock_id)
532  integer, intent(in) :: lock_id
533 
534  integer :: info
535 
536  call thread_rwlock_wrlock(lock_id,info)
538  end function forthread_rwlock_wrlock
539 
540  integer function forthread_rwlock_trywrlock(lock_id)
541  integer, intent(in) :: lock_id
542 
543  integer :: info
544 
545  call thread_rwlock_trywrlock(lock_id,info)
547  end function forthread_rwlock_trywrlock
548 
549  integer function forthread_rwlock_unlock(lock_id)
550  integer, intent(in) :: lock_id
551 
552  integer :: info
553 
554  call thread_rwlock_unlock(lock_id,info)
556  end function forthread_rwlock_unlock
557 
558 #ifndef __DARWIN
559  integer function forthread_rwlock_timedrdlock(lock_id,abs_timeout)
560  integer, intent(in) :: lock_id
561  type(timespec), intent(in) :: abs_timeout
562 
563  integer :: info
564 
565  call thread_rwlock_timedrdlock(lock_id,abs_timeout,info)
567  end function forthread_rwlock_timedrdlock
568 
569  integer function forthread_rwlock_timedwrlock(lock_id,abs_timeout)
570  integer, intent(in) :: lock_id
571  type(timespec), intent(in) :: abs_timeout
572 
573  integer :: info
574 
575  call thread_rwlock_timedwrlock(lock_id,abs_timeout,info)
577  end function forthread_rwlock_timedwrlock
578 #endif
579 
580  !*****************************************!
581  !* attribute object routines *!
582  !*****************************************!
583 
584  integer function forthread_attr_destroy(attr)
585  integer, intent(in) :: attr
586 
587  integer :: info
588 
589  call thread_attr_destroy(attr,info)
591  end function forthread_attr_destroy
592 
593  integer function forthread_attr_init(attr)
594  integer, intent(in) :: attr
595 
596  integer :: info
597 
598  call thread_attr_init(attr,info)
600  end function forthread_attr_init
601 
602  integer function forthread_attr_getdetachstate(attr,detachstate)
603  integer, intent(in) :: attr
604  integer, intent(out) :: detachstate
605 
606  integer :: info
607 
608  call thread_attr_getdetachstate(attr,detachstate,info)
610  end function forthread_attr_getdetachstate
611 
612  integer function forthread_attr_setdetachstate(attr,detachstate)
613  integer, intent(in) :: attr, detachstate
614  integer :: info
615 
616  call thread_attr_setdetachstate(attr,detachstate,info)
618  end function forthread_attr_setdetachstate
619 
620  integer function forthread_attr_getguardsize(attr,guardsize)
621  integer, intent(in) :: attr
622  integer(size_t), intent(out) :: guardsize
623 
624  integer :: info
625 
626  call thread_attr_getguardsize(attr,guardsize,info)
628  end function forthread_attr_getguardsize
629 
630  integer function forthread_attr_setguardsize(attr,guardsize)
631  integer, intent(in) :: attr
632  integer(size_t), intent(in) :: guardsize
633 
634  integer :: info
635 
636  call thread_attr_setguardsize(attr,guardsize,info)
638  end function forthread_attr_setguardsize
639 
640  integer function forthread_attr_getinheritsched(attr,inheritsched)
641  integer, intent(in) :: attr
642  integer, intent(out) :: inheritsched
643 
644  integer :: info
645 
646  call thread_attr_getinheritsched(attr,inheritsched,info)
648  end function forthread_attr_getinheritsched
649 
650  integer function forthread_attr_setinheritsched(attr,inheritsched)
651  integer, intent(in) :: attr
652  integer, intent(in) :: inheritsched
653 
654  integer :: info
655 
656  call thread_attr_setinheritsched(attr,inheritsched,info)
658  end function forthread_attr_setinheritsched
659 
660  integer function forthread_attr_getschedparam(attr,param)
661  integer, intent(in) :: attr
662  type(sched_param), intent(out) :: param
663 
664  integer :: info
665 
666  call thread_attr_getschedparam(attr,param,info)
668  end function forthread_attr_getschedparam
669 
670  integer function forthread_attr_setschedparam(attr,param)
671  integer, intent(in) :: attr
672  type(sched_param), intent(in) :: param
673 
674  integer :: info
675 
676  call thread_attr_setschedparam(attr,param,info)
678  end function forthread_attr_setschedparam
679 
680  integer function forthread_attr_getschedpolicy(attr,policy)
681  integer, intent(in) :: attr
682  integer, intent(out) :: policy
683 
684  integer :: info
685 
686  call thread_attr_getschedpolicy(attr,policy,info)
688  end function forthread_attr_getschedpolicy
689 
690  integer function forthread_attr_setschedpolicy(attr,policy)
691  integer, intent(in) :: attr, policy
692 
693  integer :: info
694 
695  call thread_attr_setschedpolicy(attr,policy,info)
697  end function forthread_attr_setschedpolicy
698 
699  integer function forthread_attr_getscope(attr,scope)
700  integer, intent(in) :: attr
701  integer, intent(out) :: scope
702 
703  integer :: info
704 
705  call thread_attr_getscope(attr,scope,info)
707  end function forthread_attr_getscope
708 
709  integer function forthread_attr_setscope(attr,scope)
710  integer, intent(in) :: attr, scope
711 
712  integer :: info
713 
714  call thread_attr_setscope(attr,scope,info)
716  end function forthread_attr_setscope
717 
718  integer function forthread_attr_getstacksize(attr,stacksize)
719  integer, intent(in) :: attr
720  integer(size_t), intent(out) :: stacksize
721 
722  integer :: info
723 
724  call thread_attr_getstacksize(attr,stacksize,info)
726  end function forthread_attr_getstacksize
727 
728  integer function forthread_attr_setstacksize(attr,stacksize)
729  integer, intent(in) :: attr
730  integer(size_t), intent(in) :: stacksize
731 
732  integer :: info
733 
734  call thread_attr_setstacksize(attr,stacksize,info)
736  end function forthread_attr_setstacksize
737 
738  !*****************************************!
739  !* mutex attribute routines *!
740  !*****************************************!
741 
742  integer function forthread_mutexattr_destroy(attr)
743  integer, intent(in) :: attr
744 
745  integer :: info
746 
747  call thread_mutexattr_destroy(attr,info)
749  end function forthread_mutexattr_destroy
750 
751  integer function forthread_mutexattr_init(attr)
752  integer, intent(in) :: attr
753 
754  integer :: info
755 
756  call thread_mutexattr_init(attr,info)
758  end function forthread_mutexattr_init
759 
760  integer function forthread_mutexattr_getpshared(attr,pshared)
761  integer, intent(in) :: attr
762  integer, intent(out) :: pshared
763 
764  integer :: info
765 
766  call thread_mutexattr_getpshared(attr,pshared,info)
768  end function forthread_mutexattr_getpshared
769 
770  integer function forthread_mutexattr_setpshared(attr,pshared)
771  integer , intent(in) :: attr
772  integer , intent(in) :: pshared
773  integer :: info
774 
775  call thread_mutexattr_setpshared(attr,pshared,info)
777  end function forthread_mutexattr_setpshared
778 
779  integer function forthread_mutexattr_getprioceiling(attr,prioceiling)
780  integer, intent(in) :: attr
781  integer, intent(out) :: prioceiling
782 
783  integer :: info
784 
785  call thread_mutexattr_getprioceiling(attr,prioceiling,info)
788 
789  integer function forthread_mutexattr_setprioceiling(attr,prioceiling)
790  integer, intent(in) :: attr, prioceiling
791 
792  integer :: info
793 
794  call thread_mutexattr_setprioceiling(attr,prioceiling,info)
797 
798  integer function forthread_mutexattr_getprotocol(attr,protocol)
799  integer, intent(in) :: attr
800  integer, intent(out) :: protocol
801 
802  integer :: info
803 
804  call thread_mutexattr_getprotocol(attr,protocol,info)
807 
808  integer function forthread_mutexattr_setprotocol(attr,protocol)
809  integer, intent(in) :: attr, protocol
810 
811  integer :: info
812 
813  call thread_mutexattr_setprotocol(attr,protocol,info)
816 
817  integer function forthread_mutexattr_gettype(attr,mtype)
818  integer, intent(in) :: attr
819  integer, intent(out) :: mtype
820 
821  integer :: info
822 
823  call thread_mutexattr_gettype(attr,mtype,info)
825  end function forthread_mutexattr_gettype
826 
827  integer function forthread_mutexattr_settype(attr,mtype)
828  integer, intent(in) :: attr, mtype
829 
830  integer :: info
831 
832  call thread_mutexattr_settype(attr,mtype,info)
834  end function forthread_mutexattr_settype
835 
836  !*****************************************************!
837  !* condition attriubute variable routines *!
838  !*****************************************************!
839 
840  integer function forthread_condattr_destroy(attr)
841  integer, intent(in) :: attr
842 
843  integer :: info
844 
845  call thread_condattr_destroy(attr,info)
847  end function forthread_condattr_destroy
848 
849  integer function forthread_condattr_init(attr)
850  integer, intent(in) :: attr
851 
852  integer :: info
853 
854  call thread_condattr_init(attr,info)
856  end function forthread_condattr_init
857 
858  integer function forthread_condattr_getpshared(attr,pshared)
859  integer, intent(in) :: attr
860  integer, intent(out) :: pshared
861 
862  integer :: info
863 
864  call thread_condattr_getpshared(attr,pshared,info)
866  end function forthread_condattr_getpshared
867 
868  integer function forthread_condattr_setpshared(attr,pshared)
869  integer, intent(in) :: attr, pshared
870 
871  integer :: info
872 
873  call thread_condattr_setpshared(attr,pshared,info)
875  end function forthread_condattr_setpshared
876 
877 #ifndef __DARWIN
878  integer function forthread_condattr_getclock(attr,clock_id)
879  integer, intent(in) :: attr
880  integer, intent(out) :: clock_id
881 
882  integer :: info
883 
884  call thread_condattr_getclock(attr,clock_id,info)
886  end function forthread_condattr_getclock
887 
888  integer function forthread_condattr_setclock(attr,clock_id)
889  integer, intent(in) :: attr
890  integer, intent(in) :: clock_id
891 
892  integer :: info
893 
894  call thread_condattr_setclock(attr,clock_id,info)
896  end function forthread_condattr_setclock
897 
898  !**************************************************!
899  !* barrier attribute variable routines *!
900  !**************************************************!
901 
902  integer function forthread_barrierattr_destroy(attr)
903  integer, intent(in) :: attr
904 
905  integer :: info
906 
907  call thread_barrierattr_destroy(attr,info)
909  end function forthread_barrierattr_destroy
910 
911  integer function forthread_barrierattr_init(attr)
912  integer, intent(in) :: attr
913 
914  integer :: info
915 
916  call thread_barrierattr_init(attr,info)
918  end function forthread_barrierattr_init
919 
920  integer function forthread_barrierattr_getpshared(attr,pshared)
921  integer, intent(in) :: attr
922  integer, intent(out) :: pshared
923 
924  integer :: info
925 
926  call thread_barrierattr_getpshared(attr,pshared,info)
929 
930  integer function forthread_barrierattr_setpshared(attr,pshared)
931  integer, intent(in) :: attr, pshared
932  integer :: info
933 
934  call thread_barrierattr_setpshared(attr,pshared,info)
937 #endif
938 
939  !**************************************************!
940  !* rwlock attribute variable routines *!
941  !**************************************************!
942 
943  integer function forthread_rwlockattr_destroy(attr)
944  integer, intent(in) :: attr
945  integer :: info
946 
947  call thread_rwlockattr_destroy(attr,info)
949  end function forthread_rwlockattr_destroy
950 
951  integer function forthread_rwlockattr_init(attr)
952  integer, intent(in) :: attr
953  integer :: info
954 
955  call thread_rwlockattr_init(attr,info)
957  end function forthread_rwlockattr_init
958 
959  integer function forthread_rwlockattr_getpshared(attr,pshared)
960  integer, intent(in) :: attr
961  integer, intent(out) :: pshared
962  integer :: info
963 
964  call thread_rwlockattr_getpshared(attr,pshared,info)
967 
968  integer function forthread_rwlockattr_setpshared(attr,pshared)
969  integer, intent(in) :: attr, pshared
970  integer :: info
971 
972  call thread_rwlockattr_setpshared(attr,pshared,info)
975 end module forthread_mod
976 
forthread_mod::forthread_attr_getschedparam
integer function forthread_attr_getschedparam(attr, param)
Definition: forthread.F90:661
forthread_mod::forthread_detach
integer function forthread_detach(thread_id)
Definition: forthread.F90:68
forthread_ciface_mod::thread_cond_init
Definition: forthread_ciface.F90:336
forthread_mod::forthread_cond_destroy
integer function forthread_cond_destroy(cond_id)
Definition: forthread.F90:347
forthread_mod::forthread_mutexattr_destroy
integer function forthread_mutexattr_destroy(attr)
Definition: forthread.F90:743
forthread_mod::forthread_attr_getscope
integer function forthread_attr_getscope(attr, scope)
Definition: forthread.F90:700
forthread_ciface_mod::thread_mutex_unlock
Definition: forthread_ciface.F90:285
forthread_ciface_mod::thread_attr_getguardsize
Definition: forthread_ciface.F90:580
forthread_ciface_mod::thread_attr_getschedparam
Definition: forthread_ciface.F90:616
forthread_ciface_mod::thread_attr_setdetachstate
Definition: forthread_ciface.F90:571
forthread_mod::forthread_attr_getschedpolicy
integer function forthread_attr_getschedpolicy(attr, policy)
Definition: forthread.F90:681
forthread_mod::forthread_key_delete
integer function forthread_key_delete(key_id)
Definition: forthread.F90:232
forthread_ciface_mod::thread_attr_setguardsize
Definition: forthread_ciface.F90:589
forthread_types::timespec
Definition: forthread_types.F90:11
forthread_mod::forthread_mutex_lock
integer function forthread_mutex_lock(mutex_id)
Definition: forthread.F90:284
forthread_data::i_once
Definition: forthread_data.F90:13
forthread_ciface_mod::thread_attr_setstacksize
Definition: forthread_ciface.F90:681
forthread_mod::forthread_attr_init
integer function forthread_attr_init(attr)
Definition: forthread.F90:594
forthread_mod::forthread_setcancelstate
integer function forthread_setcancelstate(state, oldstate)
Definition: forthread.F90:208
forthread_mod::forthread_cond_timedwait
integer function forthread_cond_timedwait(mutex, abstime)
Definition: forthread.F90:366
forthread_ciface_mod::thread_attr_getinheritsched
Definition: forthread_ciface.F90:598
forthread_ciface_mod::thread_mutexattr_getprotocol
Definition: forthread_ciface.F90:746
forthread_mod::forthread_barrierattr_setpshared
integer function forthread_barrierattr_setpshared(attr, pshared)
Definition: forthread.F90:931
forthread_ciface_mod::thread_rwlock_wrlock
Definition: forthread_ciface.F90:494
forthread_ciface_mod::thread_setschedprio
Definition: forthread_ciface.F90:176
forthread_ciface_mod::thread_attr_setinheritsched
Definition: forthread_ciface.F90:607
forthread_data::init_size
integer, parameter init_size
Definition: forthread_data.F90:33
forthread_ciface_mod::thread_key_delete
Definition: forthread_ciface.F90:210
forthread_ciface_mod::thread_mutex_timedlock
Definition: forthread_ciface.F90:313
forthread_mod::forthread_mutex_init
integer function forthread_mutex_init(mutex_id, attr_id)
Definition: forthread.F90:274
forthread_mod::forthread_once_init
integer function forthread_once_init(once_ctrl_id)
Definition: forthread.F90:123
forthread_ciface_mod::thread_spin_destroy
Definition: forthread_ciface.F90:415
forthread_types::sched_param
Definition: forthread_types.F90:5
forthread_mod::forthread_attr_setguardsize
integer function forthread_attr_setguardsize(attr, guardsize)
Definition: forthread.F90:631
forthread_mod::forthread_condattr_init
integer function forthread_condattr_init(attr)
Definition: forthread.F90:850
forthread_mod::forthread_setschedprio
integer function forthread_setschedprio(thread, prio)
Definition: forthread.F90:198
forthread_ciface_mod::thread_mutexattr_getprioceiling
Definition: forthread_ciface.F90:728
forthread_mod::forthread_mutexattr_setprioceiling
integer function forthread_mutexattr_setprioceiling(attr, prioceiling)
Definition: forthread.F90:790
forthread_mod::forthread_attr_setscope
integer function forthread_attr_setscope(attr, scope)
Definition: forthread.F90:710
forthread_mod::forthread_join
integer function forthread_join(thread_id, val)
Definition: forthread.F90:93
forthread_ciface_mod::thread_mutexattr_setprotocol
Definition: forthread_ciface.F90:755
forthread_mod::forthread_rwlockattr_init
integer function forthread_rwlockattr_init(attr)
Definition: forthread.F90:952
forthread_ciface_mod::thread_rwlock_rdlock
Definition: forthread_ciface.F90:478
forthread_mod::forthread_setschedparam
integer function forthread_setschedparam(thread, policy, param)
Definition: forthread.F90:187
forthread_ciface_mod::thread_cond_broadcast
Definition: forthread_ciface.F90:364
forthread_mod
Definition: forthread.F90:1
forthread_ciface_mod::thread_spin_init
Definition: forthread_ciface.F90:423
forthread_ciface_mod::thread_mutex_trylock
Definition: forthread_ciface.F90:277
forthread_ciface_mod::thread_create
Definition: forthread_ciface.F90:35
forthread_ciface_mod::thread_attr_getdetachstate
Definition: forthread_ciface.F90:562
forthread_mod::forthread_condattr_setpshared
integer function forthread_condattr_setpshared(attr, pshared)
Definition: forthread.F90:869
forthread_mod::forthread_attr_setstacksize
integer function forthread_attr_setstacksize(attr, stacksize)
Definition: forthread.F90:729
forthread_ciface_mod::thread_exit
Definition: forthread_ciface.F90:63
forthread_mod::forthread_rwlock_destroy
integer function forthread_rwlock_destroy(rwlock_id)
Definition: forthread.F90:495
forthread_ciface_mod::thread_detach
Definition: forthread_ciface.F90:46
forthread_ciface_mod::thread_condattr_destroy
Definition: forthread_ciface.F90:785
forthread_mod::forthread_barrierattr_init
integer function forthread_barrierattr_init(attr)
Definition: forthread.F90:912
forthread_ciface_mod::thread_attr_init
Definition: forthread_ciface.F90:554
forthread_mod::forthread_mutexattr_init
integer function forthread_mutexattr_init(attr)
Definition: forthread.F90:752
forthread_mod::forthread_spin_trylock
integer function forthread_spin_trylock(lock_id)
Definition: forthread.F90:470
forthread_ciface_mod::thread_rwlock_timedrdlock
Definition: forthread_ciface.F90:519
forthread_ciface_mod::thread_rwlock_trywrlock
Definition: forthread_ciface.F90:502
forthread_mod::forthread_mutex_destroy
integer function forthread_mutex_destroy(mutex_id)
Definition: forthread.F90:265
forthread_ciface_mod::thread_rwlock_init
Definition: forthread_ciface.F90:469
forthread_mod::forthread_cond_broadcast
integer function forthread_cond_broadcast(cond_id)
Definition: forthread.F90:385
forthread_mod::forthread_mutex_timedlock
integer function forthread_mutex_timedlock(mutex, abs_timeout)
Definition: forthread.F90:332
forthread_mod::forthread_rwlock_timedwrlock
integer function forthread_rwlock_timedwrlock(lock_id, abs_timeout)
Definition: forthread.F90:570
forthread_mod::forthread_rwlockattr_setpshared
integer function forthread_rwlockattr_setpshared(attr, pshared)
Definition: forthread.F90:969
forthread_mod::forthread_equal
integer function forthread_equal(t1, t2)
Definition: forthread.F90:77
forthread_mod::forthread_spin_unlock
integer function forthread_spin_unlock(lock_id)
Definition: forthread.F90:479
forthread_data::i_run
Definition: forthread_data.F90:7
forthread_ciface_mod::thread_init
Definition: forthread_ciface.F90:6
forthread_mod::forthread_attr_setschedpolicy
integer function forthread_attr_setschedpolicy(attr, policy)
Definition: forthread.F90:691
forthread_ciface_mod::thread_rwlockattr_setpshared
Definition: forthread_ciface.F90:905
forthread_ciface_mod::thread_once
Definition: forthread_ciface.F90:104
forthread_ciface_mod::thread_condattr_setclock
Definition: forthread_ciface.F90:829
forthread_mod::forthread_barrier_wait
integer function forthread_barrier_wait(barrier_id)
Definition: forthread.F90:427
forthread_mod::forthread_mutexattr_setpshared
integer function forthread_mutexattr_setpshared(attr, pshared)
Definition: forthread.F90:771
forthread_mod::forthread_once
integer function forthread_once(once_ctrl_id, init_routine)
Definition: forthread.F90:132
forthread_mod::forthread_rwlock_tryrdlock
integer function forthread_rwlock_tryrdlock(lock_id)
Definition: forthread.F90:523
forthread_ciface_mod::thread_setcancelstate
Definition: forthread_ciface.F90:186
forthread_mod::forthread_attr_getdetachstate
integer function forthread_attr_getdetachstate(attr, detachstate)
Definition: forthread.F90:603
forthread_data
Definition: forthread_data.F90:1
forthread_mod::forthread_attr_setschedparam
integer function forthread_attr_setschedparam(attr, param)
Definition: forthread.F90:671
forthread_data::ptr_t_run
Definition: forthread_data.F90:29
forthread_ciface_mod::thread_rwlock_timedwrlock
Definition: forthread_ciface.F90:529
forthread_ciface_mod::thread_rwlock_tryrdlock
Definition: forthread_ciface.F90:486
forthread_ciface_mod::thread_mutex_lock
Definition: forthread_ciface.F90:269
forthread_ciface_mod::thread_spin_unlock
Definition: forthread_ciface.F90:448
forthread_mod::forthread_condattr_getclock
integer function forthread_condattr_getclock(attr, clock_id)
Definition: forthread.F90:879
forthread_mod::forthread_exit
subroutine forthread_exit(val)
Definition: forthread.F90:87
forthread_mod::forthread_mutexattr_gettype
integer function forthread_mutexattr_gettype(attr, mtype)
Definition: forthread.F90:818
forthread_ciface_mod
Definition: forthread_ciface.F90:1
forthread_ciface_mod::thread_equal
Definition: forthread_ciface.F90:54
forthread_ciface_mod::thread_condattr_setpshared
Definition: forthread_ciface.F90:810
forthread_ciface_mod::i_start_routine
Definition: forthread_ciface.F90:19
forthread_mod::forthread_attr_setinheritsched
integer function forthread_attr_setinheritsched(attr, inheritsched)
Definition: forthread.F90:651
forthread_ciface_mod::thread_barrier_wait
Definition: forthread_ciface.F90:403
forthread_ciface_mod::thread_getcpuclockid
Definition: forthread_ciface.F90:142
forthread_ciface_mod::thread_rwlockattr_init
Definition: forthread_ciface.F90:888
forthread_ciface_mod::thread_rwlockattr_getpshared
Definition: forthread_ciface.F90:896
forthread_mod::forthread_mutexattr_getpshared
integer function forthread_mutexattr_getpshared(attr, pshared)
Definition: forthread.F90:761
forthread_mod::forthread_rwlock_timedrdlock
integer function forthread_rwlock_timedrdlock(lock_id, abs_timeout)
Definition: forthread.F90:560
forthread_ciface_mod::thread_barrierattr_setpshared
Definition: forthread_ciface.F90:866
forthread_ciface_mod::thread_kill
Definition: forthread_ciface.F90:87
forthread_mod::forthread_setcanceltype
integer function forthread_setcanceltype(ctype, oldctype)
Definition: forthread.F90:218
forthread_ciface_mod::thread_mutexattr_gettype
Definition: forthread_ciface.F90:764
forthread_data::routine_table_mutex
integer routine_table_mutex
Definition: forthread_data.F90:36
forthread_mod::forthread_getconcurrency
integer function forthread_getconcurrency(currlevel)
Definition: forthread.F90:146
forthread_mod::forthread_mutexattr_getprotocol
integer function forthread_mutexattr_getprotocol(attr, protocol)
Definition: forthread.F90:799
forthread_mod::forthread_attr_getinheritsched
integer function forthread_attr_getinheritsched(attr, inheritsched)
Definition: forthread.F90:641
forthread_mod::forthread_key_create
integer function forthread_key_create(key_id, destructor)
Definition: forthread.F90:241
forthread_types
Definition: forthread_types.F90:1
forthread_ciface_mod::thread_attr_getschedpolicy
Definition: forthread_ciface.F90:636
forthread_ciface_mod::thread_condattr_getclock
Definition: forthread_ciface.F90:820
forthread_mod::forthread_spin_destroy
integer function forthread_spin_destroy(spinlock_id)
Definition: forthread.F90:442
forthread_data::t_run
Definition: forthread_data.F90:24
forthread_mod::forthread_cancel
integer function forthread_cancel(thread_id)
Definition: forthread.F90:105
forthread_mod::forthread_cond_signal
integer function forthread_cond_signal(cond_id)
Definition: forthread.F90:394
forthread_mod::forthread_rwlock_trywrlock
integer function forthread_rwlock_trywrlock(lock_id)
Definition: forthread.F90:541
forthread_mod::forthread_attr_getstacksize
integer function forthread_attr_getstacksize(attr, stacksize)
Definition: forthread.F90:719
forthread_ciface_mod::thread_join
Definition: forthread_ciface.F90:70
forthread_mod::forthread_condattr_getpshared
integer function forthread_condattr_getpshared(attr, pshared)
Definition: forthread.F90:859
forthread_mod::forthread_barrier_destroy
integer function forthread_barrier_destroy(barrier_id)
Definition: forthread.F90:408
forthread_ciface_mod::thread_barrierattr_init
Definition: forthread_ciface.F90:849
forthread_mod::forthread_rwlockattr_getpshared
integer function forthread_rwlockattr_getpshared(attr, pshared)
Definition: forthread.F90:960
forthread_ciface_mod::thread_alloc
Definition: forthread_ciface.F90:27
forthread_mod::forthread_rwlock_init
integer function forthread_rwlock_init(rwlock_id, attr_id)
Definition: forthread.F90:504
forthread_mod::forthread_barrier_init
integer function forthread_barrier_init(barrier_id, attr_id, tcount)
Definition: forthread.F90:417
forthread_mod::forthread_cond_wait
integer function forthread_cond_wait(cond_id, mutex_id)
Definition: forthread.F90:376
forthread_mod::forthread_condattr_setclock
integer function forthread_condattr_setclock(attr, clock_id)
Definition: forthread.F90:889
forthread_ciface_mod::thread_barrierattr_getpshared
Definition: forthread_ciface.F90:857
forthread_mod::forthread_create
integer function forthread_create(thread_id, attr_id, run, arg)
Definition: forthread.F90:33
forthread_mod::forthread_mutexattr_setprotocol
integer function forthread_mutexattr_setprotocol(attr, protocol)
Definition: forthread.F90:809
forthread_ciface_mod::thread_mutex_setprioceiling
Definition: forthread_ciface.F90:302
forthread_mod::forthread_mutexattr_getprioceiling
integer function forthread_mutexattr_getprioceiling(attr, prioceiling)
Definition: forthread.F90:780
forthread_ciface_mod::thread_getconcurrency
Definition: forthread_ciface.F90:125
forthread_ciface_mod::thread_spin_trylock
Definition: forthread_ciface.F90:440
forthread_ciface_mod::thread_condattr_init
Definition: forthread_ciface.F90:793
forthread_ciface_mod::thread_attr_setscope
Definition: forthread_ciface.F90:663
forthread_ciface_mod::thread_cancel
Definition: forthread_ciface.F90:79
forthread_ciface_mod::thread_spin_lock
Definition: forthread_ciface.F90:432
forthread_mod::forthread_mutex_getprioceiling
integer function forthread_mutex_getprioceiling(mutex, prioceiling)
Definition: forthread.F90:311
forthread_ciface_mod::thread_barrier_init
Definition: forthread_ciface.F90:393
forthread_ciface_mod::thread_mutex_init
Definition: forthread_ciface.F90:260
forthread_ciface_mod::thread_destroy
Definition: forthread_ciface.F90:12
forthread_mod::forthread_setconcurrency
integer function forthread_setconcurrency(newlevel)
Definition: forthread.F90:155
forthread_ciface_mod::thread_attr_getstacksize
Definition: forthread_ciface.F90:672
forthread_ciface_mod::thread_cond_signal
Definition: forthread_ciface.F90:372
forthread_mod::forthread_spin_init
integer function forthread_spin_init(spinlock_id, pshared)
Definition: forthread.F90:451
forthread_ciface_mod::thread_once_init
Definition: forthread_ciface.F90:96
forthread_ciface_mod::thread_attr_setschedpolicy
Definition: forthread_ciface.F90:645
forthread_mod::forthread_mutex_setprioceiling
integer function forthread_mutex_setprioceiling(mutex, prioceiling, old_ceiling)
Definition: forthread.F90:321
forthread_ciface_mod::thread_setschedparam
Definition: forthread_ciface.F90:164
forthread_ciface_mod::thread_cond_timedwait
Definition: forthread_ciface.F90:345
forthread_ciface_mod::thread_mutexattr_settype
Definition: forthread_ciface.F90:773
forthread_mod::forthread_mutex_trylock
integer function forthread_mutex_trylock(mutex_id)
Definition: forthread.F90:293
forthread_ciface_mod::thread_rwlockattr_destroy
Definition: forthread_ciface.F90:880
forthread_mod::forthread_rwlockattr_destroy
integer function forthread_rwlockattr_destroy(attr)
Definition: forthread.F90:944
forthread_ciface_mod::thread_barrier_destroy
Definition: forthread_ciface.F90:385
forthread_ciface_mod::thread_rwlock_destroy
Definition: forthread_ciface.F90:461
forthread_mod::forthread_getschedparam
integer function forthread_getschedparam(thread, policy, param)
Definition: forthread.F90:176
forthread_ciface_mod::thread_mutexattr_getpshared
Definition: forthread_ciface.F90:710
forthread_ciface_mod::thread_mutexattr_destroy
Definition: forthread_ciface.F90:694
forthread_ciface_mod::thread_mutex_destroy
Definition: forthread_ciface.F90:252
forthread_ciface_mod::thread_barrierattr_destroy
Definition: forthread_ciface.F90:841
forthread_mod::forthread_mutex_unlock
integer function forthread_mutex_unlock(mutex_id)
Definition: forthread.F90:302
forthread_ciface_mod::thread_condattr_getpshared
Definition: forthread_ciface.F90:801
forthread_ciface_mod::thread_setcanceltype
Definition: forthread_ciface.F90:195
forthread_mod::forthread_barrierattr_getpshared
integer function forthread_barrierattr_getpshared(attr, pshared)
Definition: forthread.F90:921
forthread_mod::forthread_destroy
integer function forthread_destroy()
Definition: forthread.F90:23
forthread_ciface_mod::thread_cond_wait
Definition: forthread_ciface.F90:355
forthread_ciface_mod::thread_mutex_getprioceiling
Definition: forthread_ciface.F90:293
forthread_mod::forthread_kill
integer function forthread_kill(thread_id, sig)
Definition: forthread.F90:114
forthread_ciface_mod::thread_rwlock_unlock
Definition: forthread_ciface.F90:510
forthread_ciface_mod::thread_setconcurrency
Definition: forthread_ciface.F90:133
forthread_ciface_mod::thread_mutexattr_init
Definition: forthread_ciface.F90:702
forthread_mod::forthread_attr_setdetachstate
integer function forthread_attr_setdetachstate(attr, detachstate)
Definition: forthread.F90:613
forthread_mod::forthread_condattr_destroy
integer function forthread_condattr_destroy(attr)
Definition: forthread.F90:841
forthread_data::routine_table_size
integer routine_table_size
Definition: forthread_data.F90:35
forthread_data::i_destructor
Definition: forthread_data.F90:18
forthread_ciface_mod::thread_attr_getscope
Definition: forthread_ciface.F90:654
forthread_data::routine_table
type(ptr_t_run), dimension(:), pointer routine_table
Definition: forthread_data.F90:34
forthread_mod::forthread_mutexattr_settype
integer function forthread_mutexattr_settype(attr, mtype)
Definition: forthread.F90:828
forthread_mod::forthread_rwlock_wrlock
integer function forthread_rwlock_wrlock(lock_id)
Definition: forthread.F90:532
forthread_mod::forthread_attr_getguardsize
integer function forthread_attr_getguardsize(attr, guardsize)
Definition: forthread.F90:621
forthread_mod::forthread_rwlock_rdlock
integer function forthread_rwlock_rdlock(lock_id)
Definition: forthread.F90:514
forthread_ciface_mod::thread_cond_destroy
Definition: forthread_ciface.F90:328
forthread_mod::forthread_spin_lock
integer function forthread_spin_lock(lock_id)
Definition: forthread.F90:461
forthread_ciface_mod::thread_mutexattr_setpshared
Definition: forthread_ciface.F90:719
forthread_ciface_mod::thread_key_create
Definition: forthread_ciface.F90:219
forthread_data::start_routine
type(c_ptr) function start_routine(arg)
Definition: forthread_data.F90:43
forthread_ciface_mod::thread_attr_destroy
Definition: forthread_ciface.F90:546
forthread_mod::forthread_init
integer function forthread_init()
Definition: forthread.F90:11
forthread_mod::forthread_rwlock_unlock
integer function forthread_rwlock_unlock(lock_id)
Definition: forthread.F90:550
forthread_ciface_mod::thread_getschedparam
Definition: forthread_ciface.F90:153
forthread_mod::forthread_getcpuclockid
integer function forthread_getcpuclockid(thread, clock_id)
Definition: forthread.F90:165
forthread_mod::forthread_cond_init
integer function forthread_cond_init(cond_id, attr_id)
Definition: forthread.F90:356
forthread_ciface_mod::thread_attr_setschedparam
Definition: forthread_ciface.F90:626
forthread_mod::forthread_attr_destroy
integer function forthread_attr_destroy(attr)
Definition: forthread.F90:585
forthread_mod::forthread_barrierattr_destroy
integer function forthread_barrierattr_destroy(attr)
Definition: forthread.F90:903
forthread_ciface_mod::thread_mutexattr_setprioceiling
Definition: forthread_ciface.F90:737