From 2e2dffc835a9b69707c617e01cffb5fc02b1018d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Grubbstr=C3=B6m=20=28Grubba=29?= <grubba@grubba.org> Date: Fri, 28 Apr 2017 12:28:08 +0200 Subject: [PATCH] Backend.PollDeviceBackend: Make set_signal_event_callback() optional. Fixes "Warning: An expression of type function({ Backend = object(implements _static_modules.Builtin()->DefaultBackendClass) } : void) cannot be assigned to a variable of type function({ Backend = object(implements _static_modules.Builtin()->Backend) } : void)." Thanks to Per Cederqvist <cederp@opera.com> for the report. Fixes [LysLysKOM 22067696]. --- src/backend.cmod | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/backend.cmod b/src/backend.cmod index e0a2f13007..efd2cb83da 100644 --- a/src/backend.cmod +++ b/src/backend.cmod @@ -3289,18 +3289,30 @@ PIKECLASS PollDeviceBackend DECLARE_STORAGE - /*! @decl void set_signal_event_callback(int signum, function cb) + /*! @decl optional void set_signal_event_callback(int signum, function cb) + *! + *! Request @[cb] to be called from the backend when the signal + *! @[signum] is received. *! *! @note *! This function is a noop except for the @tt{kqueue@} case. + *! + *! @note + *! Caveat emptor: Unlikely to work. + *! + *! @seealso + *! @[signal()] */ PIKEFUN void set_signal_event_callback(int signum, function cb) + flags ID_OPTIONAL; { int q; #ifdef BACKEND_USES_KQUEUE struct kevent ev[2]; EV_SET(ev, signum, MY_POLLSIGNAL, EV_ADD, 0, 0, 0); q = kevent(THIS->set, ev, 1, NULL, 0, NULL); + + /* FIXME: Shouldn't cb be registered somewhere? */ #endif pop_n_elems(args); } -- GitLab