Cancelling a stdin.read?

Adam D. Ruppe via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Apr 11 08:14:34 PDT 2016


On Monday, 11 April 2016 at 14:57:27 UTC, Lass Safin wrote:
> I can't put it in one loop, since the window also has some 
> autonomous features.

Eh, my terminal.d and simpledisplay.d can combine event loops, 
you use a muliplexing function like select() on both the window 
and terminal so it waits for either or both at once without 
either blocking the other.

It does mean you need to skip readln though, since its buffering 
can break those multiplexing functions.


Well, anyway, take a gander at:

https://msdn.microsoft.com/en-us/library/windows/desktop/aa363794%28v=vs.85%29.aspx

which is Windows Vista and up. or on linux send yourself a sigint 
https://en.wikipedia.org/wiki/SIGINT_%28POSIX%29

kill(getpid(), SIGINT);

should do the trick. import core.sys.posix.signal; IIRC for those 
functions


More information about the Digitalmars-d-learn mailing list