c++-gtk-utils
Cgu::Thread::Exit Class Reference

A class which can be thrown to terminate the throwing thread. More...

#include <c++-gtk-utils/thread.h>

Detailed Description

A class which can be thrown to terminate the throwing thread.

This class can be thrown (instead of calling pthread_exit()) when a thread wishes to terminate itself and also ensure stack unwinding, so that destructors of local objects are called. It is caught automatically by the implementation of Cgu::Thread::Thread::start() so that it will only terminate the thread throwing it and not the whole process. See the Cgu::Thread::Thread::cancel() method above, for use when a thread wishes to terminate another one, and the caveats on the use of Cgu::Thread::Thread::cancel().

Do not throw a Cgu::Thread::Exit object in a program with more than one main loop in order to terminate one of the threads which has its own main loop. Instead, just cause its main loop to terminate by, say, calling g_main_loop_quit() on it.


The documentation for this class was generated from the following file: