The first “timer” will fire ~2s after we start the program, but the second should be stopped before it has a chance to fire.
Note that this is a simplified simulation of timers using Co-array Fortran. The language doesn’t have built-in timer features like some other languages, so we use the SLEEP intrinsic and co-arrays to demonstrate similar concepts. The “stopping” of a timer is simulated using a logical variable shared across images.
In a real-world scenario, you might want to use more sophisticated methods for timing and synchronization, possibly involving MPI libraries or other external timing mechanisms, depending on your specific requirements and the capabilities of your Fortran compiler and runtime environment.