getting status of a posix thread

This is a discussion on getting status of a posix thread within the C Programming forums, part of the General Programming Boards category; hi, I am writing a program in c that requires my main function to ask a posix thread to cancel ...

  1. #1
    Registered User
    Join Date
    Sep 2007
    Posts
    1

    getting status of a posix thread

    hi, I am writing a program in c that requires my main function to ask a posix thread to cancel after a certain timeout.

    trouble is, pthread_cancel fails if the thread has already closed.

    how would one go about procuring the status of a posix thread, given a pthread_t object?

    I've been working on this for days and I've finally narrowed it down to this problem, and google is no help

    TIA

  2. #2
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,662
    The best thing to do is to maintain the thread's state yourself.

    I suppose you could call pthread_getschedparam() and see if returns ESRCH, but I don't recommend it.

    gg

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. error monitoring thread status
    By George2 in forum C# Programming
    Replies: 1
    Last Post: 07-15-2008, 07:48 AM
  2. Monitor thread status
    By George2 in forum Windows Programming
    Replies: 0
    Last Post: 06-30-2008, 08:49 PM
  3. Replies: 2
    Last Post: 07-01-2007, 07:11 AM
  4. Messaging Between Threads, Exiting Thread On Demand, Etc.
    By HyperShadow in forum C++ Programming
    Replies: 10
    Last Post: 06-09-2007, 01:04 PM
  5. Thread Synchronization in Win32
    By passionate_guy in forum C Programming
    Replies: 0
    Last Post: 02-06-2006, 04:34 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21