Is it possible to stop all generated threads of an application in C #? That is, if applications create 2 streams, and each of them creates another stream. Is it possible in this case to stop all threads?
- By generating a stream, memorize it in some global list.
- Then bypass this list and call the Abort method for each thread.
- It is impossible to get a list of running threads through the standard API of the datnet. You can get a list of OS threads, but does not match the list of managed threads.
You can loop through all the process threads and kill them. You can iterate through all the threads of a process using the functions CreateToolhelp32Snapshot, Thread32First, Thread32Next. Here is an example
NtSuspendProcess. For the current process there will be a deadlock.
End the current process. When it is completed, all its threads will be stopped.