diff --git a/msvc/Makefile b/msvc/Makefile index dbae74d2a..a91618f81 100755 --- a/msvc/Makefile +++ b/msvc/Makefile @@ -297,6 +297,7 @@ cmp/load.lsp: $(srcdir)/cmp/load.lsp.in $(CP) $(srcdir)\cmp\load.lsp.in cmp\load.lsp cmp/cmpdefs.lsp: $(srcdir)/cmp/cmpdefs.lsp Makefile c\cut "@ECL_CC@" "$(CC)" \ + "@CC_IS_CXX@" "nil" \ "@CFLAGS@" "$(CFLAGS)" \ "@CFLAGS_OPTIMIZE@" "$(CFLAGS_OPTIMIZE)" \ "@ECL_CFLAGS@" "" \ diff --git a/src/c/unixint.d b/src/c/unixint.d index 014d60a10..087b87c5c 100644 --- a/src/c/unixint.d +++ b/src/c/unixint.d @@ -8,6 +8,7 @@ Copyright (c) 1984, Taiichi Yuasa and Masami Hagiya. Copyright (c) 1990, Giuseppe Attardi. Copyright (c) 2001, Juan Jose Garcia Ripoll. + Copyright (c) 2016, Daniel KochmaƄski. ECL is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public @@ -1118,10 +1119,39 @@ _ecl_w32_exception_filter(struct _EXCEPTION_POINTERS* ep) return excpt_result; } +static cl_object +W32_handle_in_new_thread(cl_object signal_code) +{ + /* XXX: there is some bug present only on windows platform + with importing the current thread. Don't know how to track + it though. */ +#if 0 + 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(); +#endif /* 0 */ +} + 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: + /* Doing nothing is arguably the most + reasonable. Calling (quit) causes process to exit + and Windows has problems, because "process has + unexpectably died.*/ return TRUE; default: return FALSE; @@ -1129,78 +1159,6 @@ BOOL WINAPI W32_console_ctrl_handler(DWORD type) } #endif /* ECL_WINDOWS_THREADS */ -#if 0 -static cl_object -asynchronous_signal_servicing_thread() -{ - const cl_env_ptr the_env = ecl_process_env(); - sigset_t handled_set; - cl_object signal_code; - int signo; - int interrupt_signal = 0; - if (ecl_option_values[ECL_OPT_TRAP_INTERRUPT_SIGNAL]) { - interrupt_signal = ecl_option_values[ECL_OPT_THREAD_INTERRUPT_SIGNAL]; - } - /* - * We wait here for all signals that are blocked in all other - * threads. It would be desirable to be able to wait for _all_ - * signals, but this can not be done for SIGFPE, SIGSEGV, etc. - */ - pthread_sigmask(SIG_SETMASK, NULL, &handled_set); - /* - * Under OS X we also have to explicitely add the signal we - * use to communicate process interrupts. For some unknown - * reason those signals may get lost. - */ - if (interrupt_signal) { - sigaddset(&handled_set, interrupt_signal); - pthread_sigmask(SIG_SETMASK, &handled_set, NULL); - } - ECL_CATCH_ALL_BEGIN(the_env) { - for (;;) { - /* Waiting may fail! */ - int status = sigwait(&handled_set, &signo); - if (status == 0) { -#if 0 - if (signo == interrupt_signal) { - /* If we get this signal it may be because - * of two reasons. One is that it is just - * an awake message. Then the queue is empty - * and we continue ... */ - signal_code = pop_signal(the_env); - if (Null(signal_code)) - continue; - /* ... the other one is that we are being - * interrupted, but this only happens when - * we quit */ - break; - } -#else - if (signo == interrupt_signal) { - break; - } -#endif -#ifdef SIGCHLD - if (signo == SIGCHLD) { - si_wait_for_all_processes(0); - continue; - } -#endif - signal_code = ecl_gethash_safe(ecl_make_fixnum(signo), - cl_core.known_signals, - ECL_NIL); - if (!Null(signal_code)) { - mp_process_run_function(3, @'si::handle-signal', - @'si::handle-signal', - signal_code); - } - } - } - } ECL_CATCH_ALL_END; - ecl_return0(the_env); -} -#endif - cl_object si_trap_fpe(cl_object condition, cl_object flag) { diff --git a/src/h/config.h.in b/src/h/config.h.in index 7bd23902b..1dc3c7aba 100644 --- a/src/h/config.h.in +++ b/src/h/config.h.in @@ -16,7 +16,7 @@ See file '../Copyright' for full details. */ -#if defined(_MSC_VER) || defined(__MINGW32__) || __WIN32__ || __WING64__ +#if defined(_MSC_VER) || defined(__MINGW32__) || __WIN32__ || __WIN64__ #define ECL_MS_WINDOWS_HOST #endif