Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(422)

Unified Diff: net/base/network_config_watcher_mac.cc

Issue 6353008: Allow IO operations in destructor of net::NetworkConfigWatcherMacThread (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: " Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/base/network_config_watcher_mac.cc
diff --git a/net/base/network_config_watcher_mac.cc b/net/base/network_config_watcher_mac.cc
index afec17d91f4eeccaaf4a59cd27143174e65b5f74..5cc41b19f03c417bca3f096d3fab0ccd44263435 100644
--- a/net/base/network_config_watcher_mac.cc
+++ b/net/base/network_config_watcher_mac.cc
@@ -11,6 +11,7 @@
#include "base/compiler_specific.h"
#include "base/threading/thread.h"
#include "base/mac/scoped_cftyperef.h"
+#include "base/threading/thread_restrictions.h"
namespace net {
@@ -54,10 +55,18 @@ NetworkConfigWatcherMacThread::NetworkConfigWatcherMacThread(
ALLOW_THIS_IN_INITIALIZER_LIST(method_factory_(this)) {}
NetworkConfigWatcherMacThread::~NetworkConfigWatcherMacThread() {
+ // Allow IO because Stop() calls PlatformThread::Join(), which is a blocking
+ // operation. This is expected during shutdown.
+ base::ThreadRestrictions::ScopedAllowIO allow_io;
+
Stop();
}
void NetworkConfigWatcherMacThread::Init() {
+ // Disallow IO to make sure NetworkConfigWatcherMacThread's helper thread does
+ // not perform blocking operations.
+ base::ThreadRestrictions::SetIOAllowed(false);
evanm 2011/01/20 22:07:29 Isn't this ok? It's a helper thread, no?
Raghu Simha 2011/01/20 22:17:45 Per email from willchan: "Add a ScopedAllowIO in
willchan no longer on Chromium 2011/01/20 22:47:10 I think we should add it, because if we're going t
+
// TODO(willchan): Look to see if there's a better signal for when it's ok to
// initialize this, rather than just delaying it by a fixed time.
const int kInitializationDelayMS = 1000;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698