<commit_before>/*
 * author: <NAME> <<EMAIL>>
 */

#ifndef SIGNAL_EVENT_HXX
#define SIGNAL_EVENT_HXX

#include "Event.hxx"
#include "util/BindMethod.hxx"

class SignalEvent {
    Event event;

    typedef BoundMethod<void(int)> Callback;
    Callback callback;

public:
    SignalEvent(EventLoop &loop, int sig, Callback _callback)
        :event(loop, sig, EV_SIGNAL|EV_PERSIST, SignalCallback, this),
         callback(_callback) {}

    void Add(const struct timeval *timeout=nullptr) {
        event.Add(timeout);
    }

    void Delete() {
        event.Delete();
    }

private:
    static void SignalCallback(evutil_socket_t fd, short events, void *ctx);
};

#endif<commit_msg>event/SignalEvent: make the callback const<commit_after>/*
 * author: <NAME> <<EMAIL>>
 */

#ifndef SIGNAL_EVENT_HXX
#define SIGNAL_EVENT_HXX

#include "Event.hxx"
#include "util/BindMethod.hxx"

class SignalEvent {
    Event event;

    typedef BoundMethod<void(int)> Callback;
    const Callback callback;

public:
    SignalEvent(EventLoop &loop, int sig, Callback _callback)
        :event(loop, sig, EV_SIGNAL|EV_PERSIST, SignalCallback, this),
         callback(_callback) {}

    void Add(const struct timeval *timeout=nullptr) {
        event.Add(timeout);
    }

    void Delete() {
        event.Delete();
    }

private:
    static void SignalCallback(evutil_socket_t fd, short events, void *ctx);
};

#endif
{'fraction_non_alphanumeric': 0.11689237348538846, 'fraction_numerical': 0.0, 'mean_word_length': 3.633663366336634, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '741629', 'n_tokens_mistral': 474, 'n_tokens_neox': 454, 'n_words': 110}