CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2015
    Posts
    100

    Post How to stop running thread in C

    We have a thread created using windows API in c, and i want to stop the thread from outside the thread. So exit thread cannot be used, and terminate thread cannot be used since there is critical section. how to stop the thread ?

  2. #2
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,396

    Re: How to stop running thread in C

    Thread should exit itself just returning from its thread procedure.
    If you want to stop/exit it from outside then the preferable way would be notify it using the Event (thread would need some periodic WFSO/WFMO calls to check this exit event)
    Victor Nijegorodov

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured