tasks a-s
This commit is contained in:
parent
47bf37c096
commit
b83f433714
12433 changed files with 156208 additions and 123 deletions
33
Task/Queue-Usage/Fortran/queue-usage.f
Normal file
33
Task/Queue-Usage/Fortran/queue-usage.f
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
module fifo_nodes
|
||||
type fifo_node
|
||||
integer :: datum
|
||||
! the next part is not variable and must be present
|
||||
type(fifo_node), pointer :: next
|
||||
logical :: valid
|
||||
end type fifo_node
|
||||
end module fifo_nodes
|
||||
|
||||
program FIFOTest
|
||||
use fifo
|
||||
implicit none
|
||||
|
||||
type(fifo_head) :: thehead
|
||||
type(fifo_node), dimension(5) :: ex, xe
|
||||
integer :: i
|
||||
|
||||
call new_fifo(thehead)
|
||||
|
||||
do i = 1, 5
|
||||
ex(i)%datum = i
|
||||
call fifo_enqueue(thehead, ex(i))
|
||||
end do
|
||||
|
||||
i = 1
|
||||
do
|
||||
call fifo_dequeue(thehead, xe(i))
|
||||
print *, xe(i)%datum
|
||||
i = i + 1
|
||||
if ( fifo_isempty(thehead) ) exit
|
||||
end do
|
||||
|
||||
end program FIFOTest
|
||||
Loading…
Add table
Add a link
Reference in a new issue