Chromium Code Reviews| 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; |