Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Delta Between Two Patch Sets: src/plugin/DetachedInitialization.h

Issue 29332660: Issue #3391 - Add detached initialization class
Left Patch Set: address comments Created Jan. 29, 2016, 3:37 p.m.
Right Patch Set: fix copyright year Created Feb. 8, 2016, 5:33 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « adblockplus.gyp ('k') | test/plugin/DetachedInitializationTest.cpp » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
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-2015 Eyeo GmbH 3 * Copyright (C) 2006-2016 Eyeo GmbH
Oleksandr 2016/02/05 07:36:05 Nit: 2016
Eric 2016/02/08 17:34:07 Done.
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
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details. 12 * GNU General Public License for more details.
13 * 13 *
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 EnsureInitialized(); 180 EnsureInitialized();
181 } 181 }
182 182
183 /** 183 /**
184 * Start an initialization thread if not already initialized and no initializa tion thread exists. 184 * Start an initialization thread if not already initialized and no initializa tion thread exists.
185 * 185 *
186 * \par Postcondition 186 * \par Postcondition
187 * - if returns, AlreadyStartedInitializer is true 187 * - if returns, AlreadyStartedInitializer is true
188 * - if throws, AlreadyStartedInitializer is false 188 * - if throws, AlreadyStartedInitializer is false
189 */ 189 */
190 void SpawnInitializer() 190 void SpawnInitializer()
Oleksandr 2016/02/01 02:47:09 The double checked locking is really convoluted he
Eric 2016/02/03 14:19:01 [...]
Oleksandr 2016/02/05 07:36:05 I am not convinced converting passive threads into
Eric 2016/02/08 17:34:07 There's no other place to throw it. You can't thro
Eric 2016/02/08 17:34:07 It's not what we want, at least not now. The diff
191 { 191 {
192 if (AlreadyInitialized() || AlreadyStartedInitializer()) 192 if (AlreadyInitialized() || AlreadyStartedInitializer())
193 { 193 {
194 return; // fast-return path 194 return; // fast-return path
195 } 195 }
196 // Assert we have neither completed nor started an initialization thread 196 // Assert we have neither completed nor started an initialization thread
197 /* 197 /*
198 * Try to obtain a lock, giving us permission to start the initialization th read. 198 * Try to obtain a lock, giving us permission to start the initialization th read.
199 * try_lock() is not reliable, that is, it can sometimes fail to lock when t he mutex is unlocked. 199 * try_lock() is not reliable, that is, it can sometimes fail to lock when t he mutex is unlocked.
200 * It is, however, guaranteed to succeed eventually. 200 * It is, however, guaranteed to succeed eventually.
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 { 249 {
250 EnsureInitializedNoexcept(); 250 EnsureInitializedNoexcept();
251 if (initializerException) 251 if (initializerException)
252 { 252 {
253 std::rethrow_exception(initializerException); 253 std::rethrow_exception(initializerException);
254 } 254 }
255 } 255 }
256 }; 256 };
257 257
258 #endif // _DETACHED_INITIALIZATION_H_ 258 #endif // _DETACHED_INITIALIZATION_H_
LEFTRIGHT

Powered by Google App Engine
This is Rietveld