mirror of
https://gitlab.com/embeddable-common-lisp/ecl.git
synced 2026-01-23 04:52:42 -08:00
windows: handle events
This commit is contained in:
parent
2f1517c9a8
commit
a119b491c0
1 changed files with 23 additions and 1 deletions
|
|
@ -1119,10 +1119,32 @@ _ecl_w32_exception_filter(struct _EXCEPTION_POINTERS* ep)
|
|||
return excpt_result;
|
||||
}
|
||||
|
||||
static cl_object
|
||||
W32_handle_in_new_thread(cl_object signal_code)
|
||||
{
|
||||
int outside_ecl = ecl_import_current_thread(@'si::handle-signal', ECL_NIL);
|
||||
mp_process_run_function(4, @'si::handle-signal',
|
||||
@'si::handle-signal',
|
||||
signal_code, ECL_NIL);
|
||||
if (outside_ecl) ecl_release_current_thread();
|
||||
}
|
||||
|
||||
BOOL WINAPI W32_console_ctrl_handler(DWORD type)
|
||||
{
|
||||
switch (type) {
|
||||
case CTRL_C_EVENT: /* Catch CTRL-C (ignore interrupt) */
|
||||
case CTRL_C_EVENT:
|
||||
case CTRL_BREAK_EVENT: {
|
||||
cl_object function = ECL_SYM_FUN(@'si::terminal-interrupt');
|
||||
if (function)
|
||||
W32_handle_in_new_thread(function);
|
||||
return TRUE;
|
||||
}
|
||||
case CTRL_CLOSE_EVENT:
|
||||
case CTRL_LOGOFF_EVENT:
|
||||
case CTRL_SHUTDOWN_EVENT:
|
||||
cl_object function = ECL_SYM_FUN(@'si::quit');
|
||||
if (function)
|
||||
W32_handle_in_new_thread(function);
|
||||
return TRUE;
|
||||
default:
|
||||
return FALSE;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue