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:
@@ -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 (...)
|
||||
// {
|
||||
|
||||
Reference in New Issue
Block a user