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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. TerminateThread() which is calling Interop dll function.

TerminateThread() which is calling Interop dll function.

Scheduled Pinned Locked Moved C / C++ / MFC
c++comhelp
9 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.
  • _ Offline
    _ Offline
    _T No name
    wrote on last edited by
    #1

    hi. i have one itnerop dll which i am using in a MFC application. i use the function of dll in a thread created in main application. At some event i want to TerminateThread() when i do that my dll function got hanged. when control comes to that function it looses its control. can anyone tell me what exactly happens in this senario and is TerminateThread() can be used in this manner Plz help Thanks

    CPalliniC 1 Reply Last reply
    0
    • _ _T No name

      hi. i have one itnerop dll which i am using in a MFC application. i use the function of dll in a thread created in main application. At some event i want to TerminateThread() when i do that my dll function got hanged. when control comes to that function it looses its control. can anyone tell me what exactly happens in this senario and is TerminateThread() can be used in this manner Plz help Thanks

      CPalliniC Online
      CPalliniC Online
      CPallini
      wrote on last edited by
      #2

      TerminateThread is evil and should never be used (you may use it just as extreme measure). You should use an alternative way to terminate your thread. :)

      If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
      This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
      [My articles]

      In testa che avete, signor di Ceprano?

      _ 1 Reply Last reply
      0
      • CPalliniC CPallini

        TerminateThread is evil and should never be used (you may use it just as extreme measure). You should use an alternative way to terminate your thread. :)

        If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
        This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
        [My articles]

        _ Offline
        _ Offline
        _T No name
        wrote on last edited by
        #3

        what are the other ways possible in MFC plz tell me.... i have used AfxBeginThread() to create the thread

        CPalliniC C 2 Replies Last reply
        0
        • _ _T No name

          what are the other ways possible in MFC plz tell me.... i have used AfxBeginThread() to create the thread

          CPalliniC Online
          CPalliniC Online
          CPallini
          wrote on last edited by
          #4

          You should read this assay [^]. :)

          If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
          This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
          [My articles]

          In testa che avete, signor di Ceprano?

          1 Reply Last reply
          0
          • _ _T No name

            what are the other ways possible in MFC plz tell me.... i have used AfxBeginThread() to create the thread

            C Offline
            C Offline
            Cool_Dev
            wrote on last edited by
            #5

            As its not a UI thread, better to use an CEvent in MFC to check when to exit the thread..

            CPalliniC 1 Reply Last reply
            0
            • C Cool_Dev

              As its not a UI thread, better to use an CEvent in MFC to check when to exit the thread..

              CPalliniC Online
              CPalliniC Online
              CPallini
              wrote on last edited by
              #6

              Cool_Dev wrote:

              As its not a UI thread, better to use an CEvent

              But first make sure you've read the "Avoid CMutex, CEvent, CSemaphore and CCrticalSection" assay. :)

              If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
              This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
              [My articles]

              In testa che avete, signor di Ceprano?

              _ C 2 Replies Last reply
              0
              • CPalliniC CPallini

                Cool_Dev wrote:

                As its not a UI thread, better to use an CEvent

                But first make sure you've read the "Avoid CMutex, CEvent, CSemaphore and CCrticalSection" assay. :)

                If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
                This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
                [My articles]

                _ Offline
                _ Offline
                _T No name
                wrote on last edited by
                #7

                Thanks to all of you for ur links and advices :) i will read all the eassays and then decide which will be approriate method to do my requirement. Thakx

                CPalliniC 1 Reply Last reply
                0
                • _ _T No name

                  Thanks to all of you for ur links and advices :) i will read all the eassays and then decide which will be approriate method to do my requirement. Thakx

                  CPalliniC Online
                  CPalliniC Online
                  CPallini
                  wrote on last edited by
                  #8

                  You are welcome. :)

                  If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
                  This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
                  [My articles]

                  In testa che avete, signor di Ceprano?

                  1 Reply Last reply
                  0
                  • CPalliniC CPallini

                    Cool_Dev wrote:

                    As its not a UI thread, better to use an CEvent

                    But first make sure you've read the "Avoid CMutex, CEvent, CSemaphore and CCrticalSection" assay. :)

                    If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
                    This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
                    [My articles]

                    C Offline
                    C Offline
                    Cool_Dev
                    wrote on last edited by
                    #9

                    go for windows APIs for Events instead of using MFC.. no other better ways to request a worker thread to terminate itself..

                    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