Will V support stoppable threads #27202
-
|
I was just wondering if there were any plans on implementing a feature that allows for a thread to be interrupted or stopped when it is running? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 3 replies
-
|
Use contexts https://modules.vlang.io/context.html |
Beta Was this translation helpful? Give feedback.
-
|
He means have the main program stop the thread, rather than the thread doing something itself. There are no plans to allow this. There are multiple ways to tell a thread to exit, but it has to do so itself. Or, of course, it is killed when the main program stops. |
Beta Was this translation helpful? Give feedback.
-
|
I have an idea — maybe it doesn’t have to be about waiting for the main thread to finish before running other threads. If what the person asking needs is just the ability to keep running in the background, I’ve implemented something similar in Linux in my VTF. |
Beta Was this translation helpful? Give feedback.
He means have the main program stop the thread, rather than the thread doing something itself.
There are no plans to allow this. There are multiple ways to tell a thread to exit, but it has to do so itself. Or, of course, it is killed when the main program stops.