freeze winform app until loop exits
I have an app running and when a specific button is hit it runs a bunch of tasks. I want to freeze the tasks at one point until a loop is finished. Not sure why this code isn't doing that:
Later in the code I have a loop=false in my dataReceivedHandlerFuntion to break the loop but code after this code is executing prematurely
4 Replies
that is a huge memory leak
you're subscribing additional handlers to the event as fast as possible in an infinite loop
okay well then I will not do it this way
my goal is to loop on receiving data until complete and then move on
if you want code in one thread to wait until code in another thread is done, use a reset event or semaphore
or tasks with async/await
that should be enough for me to lookup what you mean I think
thank you