Two main ways to deal with the flow. Usually you are wondering when the thread ends, you will need to hold a handle so you can figure it out. And, of course, you will close it after you discover the completion. Or you don’t care, fire-and-forget style or additional synchronization objects to signal the end of the stream function and / or you ask it to exit. In this case, you simply close the handle immediately after it starts.
Keep in mind that it is not necessary to keep the handle open to maintain flow, in case there is a source of confusion.
source
share