| Left: | ||
| Right: |
| OLD | NEW |
|---|---|
| (Empty) | |
| 1 /* | |
| 2 * This file is part of Adblock Plus <https://adblockplus.org/>, | |
| 3 * Copyright (C) 2006-2016 Eyeo GmbH | |
| 4 * | |
| 5 * Adblock Plus is free software: you can redistribute it and/or modify | |
| 6 * it under the terms of the GNU General Public License version 3 as | |
| 7 * published by the Free Software Foundation. | |
| 8 * | |
| 9 * Adblock Plus is distributed in the hope that it will be useful, | |
| 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 12 * GNU General Public License for more details. | |
| 13 * | |
| 14 * You should have received a copy of the GNU General Public License | |
| 15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. | |
| 16 */ | |
| 17 | |
| 18 #include "Scheduler.h" | |
| 19 #include <thread> | |
| 20 using namespace AdblockPlus; | |
| 21 | |
| 22 namespace | |
| 23 { | |
| 24 void SingleUseThreadMain(std::function<void()> task) | |
| 25 { | |
| 26 task(); | |
| 27 } | |
| 28 } | |
| 29 | |
| 30 void Scheduler::StartImmediatelyInSingleUseThread(std::function<void()> task) | |
| 31 { | |
| 32 if (!task) | |
| 33 { | |
| 34 return; | |
| 35 } | |
| 36 auto th = std::thread(SingleUseThreadMain, task); | |
|
sergei
2017/01/16 14:50:13
SingleUseThreadMain is definitely redundant in thi
Eric
2017/01/16 15:20:16
In this commit, yes. It grows in later change sets
hub
2017/05/12 14:45:39
With the other suggestion with task that is a uniq
| |
| 37 th.detach(); | |
| 38 } | |
| OLD | NEW |