Skip to content
Snippets Groups Projects
Commit f4ce7a93 authored by Marek Vavrusa's avatar Marek Vavrusa Committed by Gerrit Code Review
Browse files

Free all event nodes at once on exit.

Change-Id: I12e5a43c71243b0774d049b25973d34ae41b6078
parent 1c6696e8
Branches
Tags
No related merge requests found
......@@ -100,20 +100,21 @@ void evsched_delete(evsched_t **s)
pthread_mutex_destroy(&(*s)->mx);
pthread_cond_destroy(&(*s)->notify);
while (! EMPTY_HEAP(&(*s)->heap)) /* FIXME: Would be faster to simply walk through the array */
#ifndef OPENBSD_SLAB_BROKEN
/* Free allocator (all events at once). */
slab_cache_destroy(&(*s)->cache.alloc);
#else
while (! EMPTY_HEAP(&(*s)->heap))
{
event_t *e = *((event_t**)(HHEAD(&(*s)->heap)));
heap_delmin(&(*s)->heap);
evsched_event_free((*s), e);
}
#endif
free((*s)->heap.data);
(*s)->heap.data = NULL;;
#ifndef OPENBSD_SLAB_BROKEN
/* Free allocator. */
slab_cache_destroy(&(*s)->cache.alloc);
#endif
pthread_mutex_destroy(&(*s)->cache.lock);
/* Free scheduler. */
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment