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

Worker thread

Scheduled Pinned Locked Moved C / C++ / MFC
tutorialquestion
7 Posts 6 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.
  • J Offline
    J Offline
    Jhony george
    wrote on last edited by
    #1

    Hai, i am having a doubt. How to capture and terminate a worker thread..? Thanks, Manivannan

    Born to win...!

    S J S T 4 Replies Last reply
    0
    • J Jhony george

      Hai, i am having a doubt. How to capture and terminate a worker thread..? Thanks, Manivannan

      Born to win...!

      S Offline
      S Offline
      ShilpiP
      wrote on last edited by
      #2

      Google search and CP search will give you best answer. :)

      Yes U Can ...If U Can ,Dream it , U can do it ...ICAN

      1 Reply Last reply
      0
      • J Jhony george

        Hai, i am having a doubt. How to capture and terminate a worker thread..? Thanks, Manivannan

        Born to win...!

        J Offline
        J Offline
        Jijo Raj
        wrote on last edited by
        #3

        Since its your worker thread, I hope you've the worker thread handle. Look at the place where the thread is getting created. Then you can terminate it by calling TerminateThread(). Regards, Jijo.

        _____________________________________________________ http://weseetips.com[^] Visual C++ tips and tricks. Updated daily.

        S 1 Reply Last reply
        0
        • J Jhony george

          Hai, i am having a doubt. How to capture and terminate a worker thread..? Thanks, Manivannan

          Born to win...!

          S Offline
          S Offline
          SandipG
          wrote on last edited by
          #4

          Try to avoid use of TerminateThread. You can use some condition to return from the worker thread function. May be you can introduce some flag and when the fag is set to false you can return from thread function. Whenever you want to terminate the thread just reset the flag variable. You can use Events also instead of flag.

          modified on Monday, May 26, 2008 3:57 AM

          1 Reply Last reply
          0
          • J Jijo Raj

            Since its your worker thread, I hope you've the worker thread handle. Look at the place where the thread is getting created. Then you can terminate it by calling TerminateThread(). Regards, Jijo.

            _____________________________________________________ http://weseetips.com[^] Visual C++ tips and tricks. Updated daily.

            S Offline
            S Offline
            Stephen Hewitt
            wrote on last edited by
            #5

            Jijo raj wrote:

            Since its your worker thread, I hope you've the worker thread handle. Look at the place where the thread is getting created. Then you can terminate it by calling TerminateThread().

            This is bad advice which, unfortunately, is given way too often. See here[^] for details.

            Steve

            J 1 Reply Last reply
            0
            • S Stephen Hewitt

              Jijo raj wrote:

              Since its your worker thread, I hope you've the worker thread handle. Look at the place where the thread is getting created. Then you can terminate it by calling TerminateThread().

              This is bad advice which, unfortunately, is given way too often. See here[^] for details.

              Steve

              J Offline
              J Offline
              Jijo Raj
              wrote on last edited by
              #6

              Steve, I read the article. Didn't realized that its these much dangerous. :omg: Thanks a lot. :) Regards, Jijo.

              _____________________________________________________ http://weseetips.com[^] Visual C++ tips and tricks. Updated daily.

              1 Reply Last reply
              0
              • J Jhony george

                Hai, i am having a doubt. How to capture and terminate a worker thread..? Thanks, Manivannan

                Born to win...!

                T Offline
                T Offline
                ThatsAlok
                wrote on last edited by
                #7

                Manivannan@congruent wrote:

                How to capture and terminate a worker thread..?

                http://www.codeproject.com/KB/threads/usingworkerthreads.aspx[^]

                "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
                Never mind - my own stupidity is the source of every "problem" - Mixture

                cheers, Alok Gupta VC Forum Q&A :- I/IV Support CRY- Child Relief and You/codeProject$$>

                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