On Monday, 13 September 2021 at 17:18:30 UTC, eugene wrote:
Then after pressing ^C (SIGINT) the program gets SIGSEGV, since references to sg0 and sg1 are no longer valid (they are "sitting" in epoll_event structure).

... forget to mention, crashes here:

```d
    bool wait() {

        const int maxEvents = 8;
        EpollEvent[maxEvents] events;

        if (done)
            return false;

        int n = epoll_wait(id, events.ptr, maxEvents, -1);
        if (-1 == n)
            return false;

        foreach (k; 0 .. n) {
            EventSource s = events[k].es;
ulong ecode = s.eventCode(events[k].event_mask); // <<<<< SIGSEGV
```

sg0/sg1 are destroyed, so s points to wrong location.


Reply via email to