On Thursday, 23 September 2021 at 17:53:00 UTC, eugene wrote:
On Thursday, 23 September 2021 at 17:49:43 UTC, eugene wrote:
On Thursday, 23 September 2021 at 17:20:18 UTC, Steven Schveighoffer wrote:
1. ctrl-c, signal handler triggers, shutting down the loop
2. main exits
3. GC finalizes all objects, including the Stopper and it's members

but both SIGINT and SIGTERM are still **blocked**,
they just will not reach the process.

oops..

no oops, that's all right.

- when creating Signal instance, corresponding signal becames blocked

```d
final class Signal : EventSource {

    enum int sigInt = SIGINT;
    enum int sigTerm = SIGTERM;
    ulong number;

    this(int signo) {
        super('S');

        sigset_t sset;
        sigset_t old_sset;
        /* block the signal */
        sigemptyset(&sset);
        sigaddset(&sset, signo);
        sigprocmask(SIG_BLOCK, &sset, &old_sset);

        id = signalfd(-1, &sset, SFD_CLOEXEC);
```
- upon receiving SIGINT stopperIdleS0() is called.
now stop variable of EventQueue is false

- next call to wait() method just return.
(remember, signals are still blocked)




              • Re:... eugene via Digitalmars-d-learn
              • Re:... eugene via Digitalmars-d-learn
              • Re:... jfondren via Digitalmars-d-learn
              • Re:... eugene via Digitalmars-d-learn
              • Re:... Steven Schveighoffer via Digitalmars-d-learn
              • Re:... eugene via Digitalmars-d-learn
              • Re:... Steven Schveighoffer via Digitalmars-d-learn
              • Re:... eugene via Digitalmars-d-learn
              • Re:... eugene via Digitalmars-d-learn
              • Re:... eugene via Digitalmars-d-learn
              • Re:... eugene via Digitalmars-d-learn
              • Re:... eugene via Digitalmars-d-learn
              • Re:... eugene via Digitalmars-d-learn
              • Re:... eugene via Digitalmars-d-learn
              • Re:... Steven Schveighoffer via Digitalmars-d-learn
              • Re:... eugene via Digitalmars-d-learn
              • Re:... jfondren via Digitalmars-d-learn
    • Re: Program crash: GC de... H. S. Teoh via Digitalmars-d-learn
  • Re: Program crash: GC destroy... eugene via Digitalmars-d-learn

Reply via email to