thread: Add a function to pop and call all registered cleanup handlers
This commit is contained in:
@@ -399,6 +399,23 @@ void thread_cleanup_pop(bool execute)
|
||||
free(handler);
|
||||
}
|
||||
|
||||
/**
|
||||
* Described in header.
|
||||
*/
|
||||
void thread_cleanup_popall()
|
||||
{
|
||||
private_thread_t *this = (private_thread_t*)thread_current();
|
||||
cleanup_handler_t *handler;
|
||||
|
||||
while (this->cleanup_handlers->get_count(this->cleanup_handlers))
|
||||
{
|
||||
this->cleanup_handlers->remove_last(this->cleanup_handlers,
|
||||
(void**)&handler);
|
||||
handler->cleanup(handler->arg);
|
||||
free(handler);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Described in header.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user