OpenComputers

OpenComputers

46M Downloads

Thread cannot be paused or killed

zeng-github01 opened this issue · 2 comments

commented

This problem will occur when creating any thread. Is it because there is "while" in the code?

commented

could you provide a minimum project to recreate the error?

commented

could you provide a minimum project to recreate the error?

https://gist.github.com/zeng-github01/5b6a4d8338350a6dfd4d2a1fee2c1e0a

Relevant code, I think this is written exactly according to the documentation

threadUI does not stop refreshing when I press Ctrl+C. This was also the case in another script of mine, and I was finally forced to change it to interrupt ”while“ to implement it.

When the condition of while is "while not event.pull(0,"interrupted")", the loop can end normally, but the execution sequence will be stuck due to "while". This results in the need to press twice to end the program.

New problem, there is a loop thread that cannot be jumped out. Or the code behind (line 80) thread.create() cannot be executed

Update: When changing the while condition of the two threads to "while not event.pull(0,"interrupted")", the program will shut down immediately (not stuck) @PublicVoidUpdate

The code in the gist has been updated several times and may not fully comply with