Fix memory leaks, add section-object support to new test harness (#360)

This commit is contained in:
Adlai Holler
2017-06-16 09:25:16 -07:00
committed by GitHub
parent 55928f343d
commit d9dec8fdf9
9 changed files with 236 additions and 47 deletions

View File

@@ -143,6 +143,29 @@ static void runLoopSourceCallback(void *info) {
_thread = nil;
}
- (void)test_drain
{
[self performSelector:@selector(_test_drain) onThread:_thread withObject:nil waitUntilDone:YES];
}
- (void)_test_drain
{
while (true) {
@autoreleasepool {
_queueLock.lock();
std::deque<id> currentQueue = _queue;
_queue = std::deque<id>();
_queueLock.unlock();
if (currentQueue.empty()) {
return;
} else {
currentQueue.clear();
}
}
}
}
- (void)_stop
{
CFRunLoopStop(CFRunLoopGetCurrent());