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...