Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Signal handling #314

Open
ivan-pi opened this issue Feb 10, 2021 · 2 comments
Open

Signal handling #314

ivan-pi opened this issue Feb 10, 2021 · 2 comments
Labels
idea Proposition of an idea and opening an issue to discuss it medium Difficulty level is medium topic: utilities containers, strings, files, OS/environment integration, unit testing, assertions, logging, ...

Comments

@ivan-pi
Copy link
Member

ivan-pi commented Feb 10, 2021

I found a document which describes signal handling in Fortran: https://www.sharcnet.ca/help/images/4/42/Fortran_Signal_Handling.pdf

Some compilers already provide extensions, in gfortran the subroutine signal is available.

Originally posted by @ivan-pi in #308 (comment)

@ivan-pi
Copy link
Member Author

ivan-pi commented Feb 10, 2021

Reply from @awvwgk: #308 (comment)

From my experience the signal extension in gfortran and ifort is not really satisfactory, therefore I usually resort to install signal handlers via C. I use it to gracefully catch SIGINT and SIGTERM and shut down the program, depending on your compiler those are most likely completely ignored by default which makes it a pain to kill a Fortran program.

@ivan-pi
Copy link
Member Author

ivan-pi commented Feb 10, 2021

The tutorial by @interkosmos contains a small section on signals also demonstrating the approach using C: https://cyber.dabamos.de/programming/modernfortran/inter-process-communication.html#signals

Perhaps a derived type similar to the boost::asio::signal_set would be suitable for Fortran. This should also work under Windows.

@ivan-pi ivan-pi added idea Proposition of an idea and opening an issue to discuss it medium Difficulty level is medium topic: utilities containers, strings, files, OS/environment integration, unit testing, assertions, logging, ... labels Feb 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
idea Proposition of an idea and opening an issue to discuss it medium Difficulty level is medium topic: utilities containers, strings, files, OS/environment integration, unit testing, assertions, logging, ...
Projects
None yet
Development

No branches or pull requests

1 participant