Threading Concept.
-
Hi I am creating two threads in my main method. One: UI Thread which runs the UIMethod. Second: Background Thread which runs the BackGroundMethod. Now in the BackGroundMethod, I am calling several other methods which create many many threads and do lot of background work. How can I know in the Main Method, when all of the entire threads created have terminated? If I use Join method, then it would wait only for the BackgroundMethod to finish and not all the threads in the BackGroundMethod. Can anyone help me on this??
-
Hi I am creating two threads in my main method. One: UI Thread which runs the UIMethod. Second: Background Thread which runs the BackGroundMethod. Now in the BackGroundMethod, I am calling several other methods which create many many threads and do lot of background work. How can I know in the Main Method, when all of the entire threads created have terminated? If I use Join method, then it would wait only for the BackgroundMethod to finish and not all the threads in the BackGroundMethod. Can anyone help me on this??
ptr2void wrote:
If I use Join method, then it would wait only for the BackgroundMethod to finish and not all the threads in the BackGroundMethod.
Ok- you should take a look at signaling methods like
Monitor.Pulse()
andMonitor.Wait()
. Read this[^]. Also take a look at WaitHandles[^]. It is the way which you can use to communicate across threads.All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia How to use google | Ask smart questions
-
ptr2void wrote:
If I use Join method, then it would wait only for the BackgroundMethod to finish and not all the threads in the BackGroundMethod.
Ok- you should take a look at signaling methods like
Monitor.Pulse()
andMonitor.Wait()
. Read this[^]. Also take a look at WaitHandles[^]. It is the way which you can use to communicate across threads.All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia How to use google | Ask smart questions
-
I am fairly new to all this.. Could you tell me the basic logic how to go about it? Then probably I may read the documentation and try out..
It's too big topic to explain here. Read the links, it's pretty easy to get started.
All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia How to use google | Ask smart questions
-
I am fairly new to all this.. Could you tell me the basic logic how to go about it? Then probably I may read the documentation and try out..