thread: Add a function to pop and call all registered cleanup handlers
This commit is contained in:
@@ -559,6 +559,26 @@ void thread_cleanup_pop(bool execute)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Described in header.
|
||||
*/
|
||||
void thread_cleanup_popall()
|
||||
{
|
||||
private_thread_t *this;
|
||||
cleanup_t cleanup = {};
|
||||
bool old;
|
||||
|
||||
this = get_current_thread();
|
||||
while (array_count(this->cleanup))
|
||||
{
|
||||
old = set_leak_detective(FALSE);
|
||||
array_remove(this->cleanup, -1, &cleanup);
|
||||
set_leak_detective(old);
|
||||
|
||||
cleanup.cb(cleanup.arg);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Described in header.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user