CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Feb 2007
    Posts
    258

    how to say that thread is running or not

    hi all,

    i have made a worker thread.what i want to know is that how to know that thread is running at a particular time.

    Thanks in advance

  2. #2
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: how to say that thread is running or not

    When you create the thread, save its handle and use GetExitCodeThread to check if the thread is still running.

  3. #3
    Join Date
    Apr 2005
    Location
    Norway
    Posts
    3,934

    Re: how to say that thread is running or not

    Another way is to pass the thread handle to WaitForSingleObject or one of the other WaitForXXX functions.

    - petter

  4. #4
    Join Date
    Nov 2003
    Location
    Belgium
    Posts
    8,150

    Re: how to say that thread is running or not

    [ moved thread ]
    Marc Gregoire - NuonSoft (http://www.nuonsoft.com)
    My Blog
    Wallpaper Cycler 3.5.0.97

    Author of Professional C++, 4th Edition by Wiley/Wrox (includes C++17 features)
    ISBN: 978-1-119-42130-6
    [ http://www.facebook.com/professionalcpp ]

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