Terminating a thread (which is blocking)
Timothy Foster via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Thu Aug 24 00:23:15 PDT 2017
I've started a thread at the beginning of my program that waits
for user input:
`thread = new Thread(&checkInput).start;`
`static void checkInput(){
foreach (line; stdin.byLineCopy) { ... }
}`
I need to stop checking for user input at some point in my
program but I'm not sure how to kill this thread.
`thread.yield();` called from my main thread doesn't kill it and
I'm not sure how to send a message to the input checking thread
to get it to terminate itself when `stdin.byLineCopy` just sits
there and blocks until user input is received.
More information about the Digitalmars-d-learn
mailing list