Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Threading Concept.

Threading Concept.

Scheduled Pinned Locked Moved C#
questiondesignhelp
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    ptr2void
    wrote on last edited by
    #1

    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??

    N 1 Reply Last reply
    0
    • P ptr2void

      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??

      N Offline
      N Offline
      N a v a n e e t h
      wrote on last edited by
      #2

      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() and Monitor.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

      P 1 Reply Last reply
      0
      • N N a v a n e e t h

        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() and Monitor.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

        P Offline
        P Offline
        ptr2void
        wrote on last edited by
        #3

        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..

        N E 2 Replies Last reply
        0
        • P ptr2void

          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..

          N Offline
          N Offline
          N a v a n e e t h
          wrote on last edited by
          #4

          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

          1 Reply Last reply
          0
          • P ptr2void

            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..

            E Offline
            E Offline
            exhaulted
            wrote on last edited by
            #5

            I'd recommend the WaitHandles, implement a simple application with 2 threads and get some examples of how to use waithandles from MSDN[^] or where ever google points you. Once you understand how to use them in a simple application implement them in your more complicated application

            Kev http://esendexdeveloper.spaces.live.com/

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups