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 / C++ / MFC
  4. diff betwn child and worker thread?

diff betwn child and worker thread?

Scheduled Pinned Locked Moved C / C++ / MFC
question
11 Posts 9 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.
  • V vikas amin

    what is the difference between Child thread Worker thread How do we create both threads /?? Vikas Amin Embin Technology Bombay

    K Offline
    K Offline
    khan
    wrote on last edited by
    #2

    I believe they are the same thing. Worker threads are child threads if they are in the same process. A child thread closes when the main thread of the program closes. this is this.

    1 Reply Last reply
    0
    • V vikas amin

      what is the difference between Child thread Worker thread How do we create both threads /?? Vikas Amin Embin Technology Bombay

      V Offline
      V Offline
      Vipin Aravind
      wrote on last edited by
      #3

      Conceptually, in MFC we got two type of threads:- UI threads and worker threads. Have a look at AfxBeginThread(...) documentation. Vipin - MVP

      D 1 Reply Last reply
      0
      • V Vipin Aravind

        Conceptually, in MFC we got two type of threads:- UI threads and worker threads. Have a look at AfxBeginThread(...) documentation. Vipin - MVP

        D Offline
        D Offline
        David Crow
        wrote on last edited by
        #4

        Vipin Aravind wrote:

        Conceptually, in MFC we got two type of threads:- UI threads and worker threads.

        Specifically, however, they are thread with message pump, and thread without message pump.


        "The greatest good you can do for another is not just to share your riches but to reveal to him his own." - Benjamin Disraeli

        E 1 Reply Last reply
        0
        • D David Crow

          Vipin Aravind wrote:

          Conceptually, in MFC we got two type of threads:- UI threads and worker threads.

          Specifically, however, they are thread with message pump, and thread without message pump.


          "The greatest good you can do for another is not just to share your riches but to reveal to him his own." - Benjamin Disraeli

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

          david, can you explain it a little more? you mean UI->with msg pump and worker without Msg pmup?:~


          VuNic

          M D 2 Replies Last reply
          0
          • E Eytukan

            david, can you explain it a little more? you mean UI->with msg pump and worker without Msg pmup?:~


            VuNic

            M Offline
            M Offline
            Maximilien
            wrote on last edited by
            #6

            one thread (with the message pump ) receives messages from Windows, the other not.


            Maximilien Lincourt Your Head A Splode - Strong Bad

            1 Reply Last reply
            0
            • E Eytukan

              david, can you explain it a little more? you mean UI->with msg pump and worker without Msg pmup?:~


              VuNic

              D Offline
              D Offline
              David Crow
              wrote on last edited by
              #7

              A "worker thread" can do some UI stuff (e.g., PostMessage() and an occasional SendMessage()), and a "UI thread" can do worker stuff, so the terms are mostly meaningless.


              "The greatest good you can do for another is not just to share your riches but to reveal to him his own." - Benjamin Disraeli

              1 Reply Last reply
              0
              • V vikas amin

                what is the difference between Child thread Worker thread How do we create both threads /?? Vikas Amin Embin Technology Bombay

                P Offline
                P Offline
                Prakash Nadar
                wrote on last edited by
                #8

                vikas, What are you working on? I have noticed that you have been posting very basic questions. one or two is fine, but you have posted many of them. The questions you ask are generally asked my collage students, we can understand about them but you are a working professional working in Embin Technology. You should really buy a good book and read it nicely and read it again so that you get good knowledge w.r.t windows development. Take this as an advice, it will help you in your development career too. coming to ur question, Worker thread is (generally) a child thread of a process. Windows actually has the concept of UI Thread (contains windows message queue and a message pump) and worker thread does not have a message queue. Threads can be created using CreateThread(...) api, All threads that are created are always created as a worker thread i.e. no message queue, whenever someone posts a message to the thread or the thread creates a window, etc (anything that requires the thread to have a message queue) the message queue is created for the worker thread so effectivly the worker thread is now a UI Thread. why windows does this? Well the reason is very basic, to save memory, a worker thread which does not deal with any windows message do not need a message queue and so the memory is saved for the thread.


                -Prakash

                E 1 Reply Last reply
                0
                • P Prakash Nadar

                  vikas, What are you working on? I have noticed that you have been posting very basic questions. one or two is fine, but you have posted many of them. The questions you ask are generally asked my collage students, we can understand about them but you are a working professional working in Embin Technology. You should really buy a good book and read it nicely and read it again so that you get good knowledge w.r.t windows development. Take this as an advice, it will help you in your development career too. coming to ur question, Worker thread is (generally) a child thread of a process. Windows actually has the concept of UI Thread (contains windows message queue and a message pump) and worker thread does not have a message queue. Threads can be created using CreateThread(...) api, All threads that are created are always created as a worker thread i.e. no message queue, whenever someone posts a message to the thread or the thread creates a window, etc (anything that requires the thread to have a message queue) the message queue is created for the worker thread so effectivly the worker thread is now a UI Thread. why windows does this? Well the reason is very basic, to save memory, a worker thread which does not deal with any windows message do not need a message queue and so the memory is saved for the thread.


                  -Prakash

                  E Offline
                  E Offline
                  Eytukan
                  wrote on last edited by
                  #9

                  hmm..you are really caring :)


                  VuNic

                  R 1 Reply Last reply
                  0
                  • E Eytukan

                    hmm..you are really caring :)


                    VuNic

                    R Offline
                    R Offline
                    Rage
                    wrote on last edited by
                    #10

                    I second what he said. I am really surprised too that someone employed somewhere to write such code actually does know so little about the subject. :doh: ~RaGE();

                    1 Reply Last reply
                    0
                    • V vikas amin

                      what is the difference between Child thread Worker thread How do we create both threads /?? Vikas Amin Embin Technology Bombay

                      L Offline
                      L Offline
                      Laxman9
                      wrote on last edited by
                      #11

                      we can create UI(user interface) thread with the CreateThread() or AfxBeginThread ()api we have to pass the class as a parameter to this function which is derived from the CWinThread and should be able to provide RUNTIME_CLASS. CWinThread handles the Message pump. and what we normaly create the threads are worker threads (i.e passing the threadproc to AfxBeginThread() function) Thanks and Regards Laxman FAILURE is the first step towards SUCCESS :cool:

                      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