|
@@ -53,6 +53,15 @@ ThreadTermFunc addThreadTermFunc(ThreadTermFunc onTerm)
|
|
return old;
|
|
return old;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+void callThreadTerminationHooks()
|
|
|
|
+{
|
|
|
|
+ if (threadTerminationHook)
|
|
|
|
+ {
|
|
|
|
+ (*threadTerminationHook)();
|
|
|
|
+ threadTerminationHook = NULL;
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
PointerArray *exceptionHandlers = NULL;
|
|
PointerArray *exceptionHandlers = NULL;
|
|
MODULE_INIT(INIT_PRIORITY_JTHREAD)
|
|
MODULE_INIT(INIT_PRIORITY_JTHREAD)
|
|
{
|
|
{
|
|
@@ -272,11 +281,7 @@ int Thread::begin()
|
|
handleException(MakeStringException(0, "Unknown exception in Thread %s", getName()));
|
|
handleException(MakeStringException(0, "Unknown exception in Thread %s", getName()));
|
|
}
|
|
}
|
|
#endif
|
|
#endif
|
|
- if (threadTerminationHook)
|
|
|
|
- {
|
|
|
|
- (*threadTerminationHook)();
|
|
|
|
- threadTerminationHook = NULL;
|
|
|
|
- }
|
|
|
|
|
|
+ callThreadTerminationHooks();
|
|
#ifdef _WIN32
|
|
#ifdef _WIN32
|
|
#ifndef _DEBUG
|
|
#ifndef _DEBUG
|
|
CloseHandle(hThread); // leak handle when debugging,
|
|
CloseHandle(hThread); // leak handle when debugging,
|
|
@@ -832,11 +837,7 @@ public:
|
|
handleException(MakeStringException(0, "Unknown exception in Thread from pool %s", parent.poolname.get()));
|
|
handleException(MakeStringException(0, "Unknown exception in Thread from pool %s", parent.poolname.get()));
|
|
}
|
|
}
|
|
#endif
|
|
#endif
|
|
- if (threadTerminationHook)
|
|
|
|
- {
|
|
|
|
- (*threadTerminationHook)(); // Reset any pre-thread state.
|
|
|
|
- threadTerminationHook = NULL;
|
|
|
|
- }
|
|
|
|
|
|
+ callThreadTerminationHooks(); // Reset any pre-thread state.
|
|
} while (parent.notifyStopped(this));
|
|
} while (parent.notifyStopped(this));
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|