1
0
mirror of https://github.com/TomHarte/CLK.git synced 2026-04-20 10:17:05 +00:00

Embraces std::make_[unique/shared] in place of .reset(new .

This commit is contained in:
Thomas Harte
2019-12-23 21:31:46 -05:00
parent ac604b30f3
commit 0dae608da5
40 changed files with 86 additions and 68 deletions
+3 -3
View File
@@ -18,7 +18,7 @@ AsyncTaskQueue::AsyncTaskQueue()
#ifdef __APPLE__
serial_dispatch_queue_ = dispatch_queue_create("com.thomasharte.clocksignal.asyntaskqueue", DISPATCH_QUEUE_SERIAL);
#else
thread_.reset(new std::thread([this]() {
thread_ = std::make_unique<std::thread>([this]() {
while(!should_destruct_) {
std::function<void(void)> next_function;
@@ -39,7 +39,7 @@ AsyncTaskQueue::AsyncTaskQueue()
processing_condition_.wait(lock);
}
}
}));
});
#endif
}
@@ -88,7 +88,7 @@ DeferringAsyncTaskQueue::~DeferringAsyncTaskQueue() {
void DeferringAsyncTaskQueue::defer(std::function<void(void)> function) {
if(!deferred_tasks_) {
deferred_tasks_.reset(new std::list<std::function<void(void)>>);
deferred_tasks_ = std::make_shared<std::list<std::function<void(void)>>>();
}
deferred_tasks_->push_back(function);
}