Left: | ||
Right: |
LEFT | RIGHT |
---|---|
1 /* | 1 /* |
2 * This file is part of Adblock Plus <https://adblockplus.org/>, | 2 * This file is part of Adblock Plus <https://adblockplus.org/>, |
3 * Copyright (C) 2006-present eyeo GmbH | 3 * Copyright (C) 2006-present eyeo GmbH |
4 * | 4 * |
5 * Adblock Plus is free software: you can redistribute it and/or modify | 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 | 6 * it under the terms of the GNU General Public License version 3 as |
7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
8 * | 8 * |
9 * Adblock Plus is distributed in the hope that it will be useful, | 9 * Adblock Plus is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
90 */ | 90 */ |
91 void Dispatch(const std::function<void()>& call) | 91 void Dispatch(const std::function<void()>& call) |
92 { | 92 { |
93 std::lock_guard<std::mutex> lock(asyncExecutorMutex); | 93 std::lock_guard<std::mutex> lock(asyncExecutorMutex); |
94 if (!executor) | 94 if (!executor) |
95 return; | 95 return; |
96 executor->Dispatch(call); | 96 executor->Dispatch(call); |
97 } | 97 } |
98 | 98 |
99 /** | 99 /** |
100 * Destroyes internally held `AsyncExecutor`, any subsequent calls of | 100 * Destroys internally held `AsyncExecutor`, any subsequent calls of |
hub
2018/03/19 11:48:43
nit: "Destroys"
sergei
2018/03/19 12:34:26
Done.
| |
101 * `Dispatch` have no effect. | 101 * `Dispatch` have no effect. |
102 */ | 102 */ |
103 void Invalidate() | 103 void Invalidate() |
104 { | 104 { |
105 std::unique_ptr<AsyncExecutor> tmp; | 105 std::unique_ptr<AsyncExecutor> tmp; |
106 { | 106 { |
107 std::lock_guard<std::mutex> lock(asyncExecutorMutex); | 107 std::lock_guard<std::mutex> lock(asyncExecutorMutex); |
108 tmp = move(executor); | 108 tmp = move(executor); |
109 } | 109 } |
110 } | 110 } |
111 private: | 111 private: |
112 std::mutex asyncExecutorMutex; | 112 std::mutex asyncExecutorMutex; |
113 std::unique_ptr<AsyncExecutor> executor; | 113 std::unique_ptr<AsyncExecutor> executor; |
114 }; | 114 }; |
115 } | 115 } |
LEFT | RIGHT |