2
0
mirror of https://github.com/boostorg/thread.git synced 2026-01-27 19:32:11 +00:00

Moved the on_thread_exit call to a destructor

[SVN r34469]
This commit is contained in:
Peter Dimov
2006-07-06 19:47:12 +00:00
parent 228f11262e
commit 34bd87cea7

View File

@@ -94,6 +94,18 @@ public:
bool m_started;
};
#if defined(BOOST_HAS_WINTHREADS)
struct on_thread_exit_guard
{
~on_thread_exit_guard()
{
on_thread_exit();
}
};
#endif
} // unnamed namespace
extern "C" {
@@ -107,13 +119,16 @@ extern "C" {
{
// try
{
#if defined(BOOST_HAS_WINTHREADS)
on_thread_exit_guard guard;
#endif
thread_param* p = static_cast<thread_param*>(param);
boost::function0<void> threadfunc = p->m_threadfunc;
p->started();
threadfunc();
#if defined(BOOST_HAS_WINTHREADS)
on_thread_exit();
#endif
}
// catch (...)
// {