Switch interrupt_handler to return maybe_t<char_event_t>

Prepares to remove R_NULL
This commit is contained in:
ridiculousfish
2019-03-16 14:45:36 -07:00
parent 1ef2404e1c
commit 70a92a9710
2 changed files with 4 additions and 4 deletions

View File

@@ -249,7 +249,7 @@ void input_mapping_add(const wchar_t *sequence, const wchar_t *command, const wc
/// Handle interruptions to key reading by reaping finshed jobs and propagating the interrupt to the
/// reader.
static maybe_t<int> interrupt_handler() {
static maybe_t<char_event_t> interrupt_handler() {
// Fire any pending events.
event_fire_delayed();
// Reap stray processes, including printing exit status messages.
@@ -260,10 +260,10 @@ static maybe_t<int> interrupt_handler() {
if (vintr == 0) {
return none();
}
return vintr;
return char_event_t{vintr};
}
return R_NULL;
return char_event_t{R_NULL};
}
static std::atomic<bool> input_initialized{false};

View File

@@ -124,7 +124,7 @@ class char_event_t {
/// A type of function invoked on interrupt.
/// \return the event which is to be returned to the reader loop, or none if VINTR is 0.
using interrupt_func_t = maybe_t<int> (*)();
using interrupt_func_t = maybe_t<char_event_t> (*)();
/// Init the library with an interrupt function.
void input_common_init(interrupt_func_t func);