Does the cancelation exception have a name?

Alexander Terekhov terekhov at web.de
Sat Nov 4 21:25:50 UTC 2006


#define PTHREAD_CANCELED std::thread_canceled()

struct thread_canceled {
  operator void * () { return &unique; }
  static thread_canceled unique;
};

extern "C" void pthread_exit(void * ptr)
	throw(std::thread_termination_request) {
  ptr == PTHREAD_CANCELED ? std::thread_cancel() :
                            std::thread_exit(ptr);

} 
template<typename T>
void thread_exit(T value) {
  assert(std::thread_self().can_exit_with<T>());
  throw thread_exit_value(value);
}

template<>
void thread_exit(std::thread_canceled) {
  thread_cancel();
}

void thread_cancel() {
  throw std::thread_cancel_request();
} 

regards,
alexender.




More information about the c++-pthreads mailing list