LIU Hao wrote:

> One thing you should note is that the handler for SIGINT runs on its own 
> thread:
>
>     #include <windows.h>
>     #include <stdio.h>
>     #include <signal.h>
>
>     volatile sig_atomic_t handler_tid = 0;
>
>     void
>     ctrl_c_handler(int sig)
>       {
>         handler_tid = GetCurrentThreadId();
>       }
>
>     int
>     main(void)
>       {
>        signal(SIGINT, ctrl_c_handler);
>         fprintf(stderr, "sleeping for 5 seconds\n");
>         Sleep(5000);
>         fprintf(stderr, "resuming\n");
>
>         fprintf(stderr, "main tid = %d\n", (int) GetCurrentThreadId());
>         fprintf(stderr, "handler tid = %d\n", (int) handler_tid);
>       }
>
>
> This can give (of course you will need to press Ctrl+C once before 
> 'resuming'):
>
>     sleeping for 5 seconds
>     resuming
>     main tid = 4144
>     handler tid = 20976
>
> If `siglongjmp()` is called in such a handler, it will jump to another 
> thread. This doesn't seem
> POSIX-compliant anyway, so I'm dropping this patch for now.

While we were testing things, I mentioned to Pali that I would prefer that 
instead of providing public `sigsetjmp`/`siglongjmp` functions, we would 
provide them as mingw-specific functions with __mingw_ prefix. One of my 
concerns was also that we can break user code if we ever change their ABI. What 
do you think about this?

Note that those `sigsetjmp`/`siglongjmp` are used by new t_sigfpe test, so we 
cannot completely remove them; simply renaming them to have __mingw_ prefix 
shouldn't be a big problem.

- Kirill Makurin

_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to