CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: Stop a pthread

  1. #1

    Stop a pthread

    I need to know what is the simplest way to stop a pthread. I dont want to use nor I am using mutex lock and unlock, but my threads are running fine and I want to stop the running thread if a global variable is set.

    can somebody throw some light on this.


  2. #2
    Join Date
    Jul 2002

    Re: Stop a pthread

    Use pthread_cancel function:
    When pthread_cancel is called from another thread, and one of cancellation points is executed, thread is terminated. Full list of cancellation points:

    If thread doesn't contain cancellation points (like computation thread), use pthread_testcancel on every iteration.

Posting Permissions

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

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

On-Demand Webinars (sponsored)

We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.