BetterC + Windows + setjmp longjmp

kinke noone at nowhere.com
Wed May 22 19:47:23 UTC 2019


On Wednesday, 22 May 2019 at 16:37:36 UTC, Lobachevsky wrote:
> I have been experimenting with setjmp / longjmp under Windows 
> as a way to break out of an endless loop.  With my experiments, 
> longjmp appears to silently exit the process, no stack trace, 
> nothing.  Black emptiness.

I don't think breaking out of a loop this way can work. The 
CtrlHandler is called by another thread. Quoting from 
https://docs.microsoft.com/en-us/windows/console/handlerroutine:

> An application-defined function used with the 
> SetConsoleCtrlHandler function. A console process uses this 
> function to handle control signals received by the process. 
> When the signal is received, the system creates a new thread in 
> the process to execute the function.


More information about the Digitalmars-d-learn mailing list