Is there a parent-child connection between threads that are spawned? If I kill the thread from where I spawned other threads, are those going to get killed too? Is this OS specific?
相关问题
- How to let a thread communicate with another activ
- Share Arc between closures
- Why it isn't advised to call the release() met
- ThreadPoolTaskScheduler behaviour when pool is ful
- Function references: expected bound lifetime param
相关文章
- How can I convert a f64 to f32 and get the closest
- What is a good way of cleaning up after a unit tes
- Difference between Thread#run and Thread#wakeup?
- Java/Spring MVC: provide request context to child
- Threading in C# , value types and reference types
- RMI Threads prevent JVM from exiting after main()
- How can I unpack (destructure) elements from a vec
- Async task does not work properly (doInBackground
It doesn't; there is no way to kill a thread.
See also:
When you spawn a thread, you get a
JoinHandle
that allows you to wait for the child thread to finish. The child does not know of the parent.The documentation for
thread::spawn
covers this well:That is, once a child thread has been started, what happens to the parent thread basically doesn't matter, unless the parent thread was the main thread, in which case the entire process is terminated.