| 78 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // |
| 79 | |
| 80 | void Foam::sigInt::set(const bool) |
| 81 | { |
| 82 | if (oldAction_.sa_handler) |
| 83 | { |
| 84 | FatalErrorInFunction |
| 85 | << "Cannot call sigInt::set() more than once" |
| 86 | << abort(FatalError); |
| 87 | } |
| 88 | |
| 89 | struct sigaction newAction; |
| 90 | newAction.sa_handler = sigHandler; |
| 91 | newAction.sa_flags = SA_NODEFER; |
| 92 | sigemptyset(&newAction.sa_mask); |
| 93 | if (sigaction(SIGINT, &newAction, &oldAction_) < 0) |
| 94 | { |
| 95 | FatalErrorInFunction |
| 96 | << "Cannot set SIGINT trapping" |
| 97 | << abort(FatalError); |
| 98 | } |
| 99 | } |
| 100 | |
| 101 | |
| 102 | // ************************************************************************* // |