Reputation: 143
Is it when all the threads in a process have no more instructions to execute?
Upvotes: 4
Views: 107
Reputation: 239754
When something calls ExitProcess
or any morally equivalent functions1, or,
differentiating now between background and foreground threads2, when the last foreground thread stops executing.
Threads stop executing when they return from their initial entry-point method, or, when ExitThread
(or moral equivalents) is called on them.
1E.g. Environment.Exit
or Environment.FailFast
are two common closely equivalent managed versions.
2Foreground and background threads are a managed code concept. Any unmanaged threads started directly through the windows API are the equivalent of foreground threads.
Upvotes: 4