subroutine exitloop(signum) integer :: signum write(*,*)'Caught SIGINT. Exiting infinite loop.' loop=.false. end subroutine exitloop