1 #ifndef CARMA_UTIL_THREAD_QUIT_H
2 #define CARMA_UTIL_THREAD_QUIT_H
10 void ThreadQuitTestSelf( );
12 void RequestThreadQuit( ::pthread_t thread );
14 bool CaughtExceptionIsThreadQuitRequestedError( );
16 void RethrowCaughtExceptionIfThreadQuitRequestedError( );
18 bool MarkCaughtExceptionOkayToDestructIfThreadQuitRequestedError( );
21 class ScopedThreadQuitDeferSelf {
23 explicit ScopedThreadQuitDeferSelf( );
25 ~ScopedThreadQuitDeferSelf( );
29 ScopedThreadQuitDeferSelf(
const ScopedThreadQuitDeferSelf & );
30 ScopedThreadQuitDeferSelf & operator=(
const ScopedThreadQuitDeferSelf & );
34 class ScopedThreadQuitRegisterSelf {
36 explicit ScopedThreadQuitRegisterSelf( );
38 ~ScopedThreadQuitRegisterSelf( );
42 ScopedThreadQuitRegisterSelf(
const ScopedThreadQuitRegisterSelf & );
43 ScopedThreadQuitRegisterSelf & operator=(
const ScopedThreadQuitRegisterSelf & );
47 class ThreadQuitRequestHandler {
49 virtual ~ThreadQuitRequestHandler( ) { }
51 virtual void HandleQuitRequest( ::pthread_t thread ) = 0;
55 class ScopedThreadQuitRequestHandlerSelf {
57 explicit ScopedThreadQuitRequestHandlerSelf( ThreadQuitRequestHandler & handler );
59 ~ScopedThreadQuitRequestHandlerSelf( );
63 ScopedThreadQuitRequestHandlerSelf(
const ScopedThreadQuitRequestHandlerSelf & );
64 ScopedThreadQuitRequestHandlerSelf & operator=(
const ScopedThreadQuitRequestHandlerSelf & );
66 ::size_t handlerCookie_;