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

Unified Diff: net/tools/quic/test_tools/server_thread.cc

Issue 127633002: Land Recent QUIC Changes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 | « net/tools/quic/test_tools/server_thread.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/tools/quic/test_tools/server_thread.cc
diff --git a/net/tools/quic/test_tools/server_thread.cc b/net/tools/quic/test_tools/server_thread.cc
index a1bebc760d5d8b1239c2797feb89a962e25ce3d0..ecc8ccdd61c8a2a80ef59763d122b51831760a39 100644
--- a/net/tools/quic/test_tools/server_thread.cc
+++ b/net/tools/quic/test_tools/server_thread.cc
@@ -17,9 +17,6 @@ ServerThread::ServerThread(IPEndPoint address,
: SimpleThread("server_thread"),
listening_(true, false),
confirmed_(true, false),
- pause_(true, false),
- paused_(true, false),
- resume_(true, false),
quit_(true, false),
server_(config, supported_versions),
address_(address),
@@ -41,12 +38,10 @@ void ServerThread::Run() {
listening_.Signal();
while (!quit_.IsSignaled()) {
- if (pause_.IsSignaled() && !resume_.IsSignaled()) {
- paused_.Signal();
- resume_.Wait();
- }
+ event_loop_mu_.Acquire();
server_.WaitForEvents();
MaybeNotifyOfHandshakeConfirmation();
+ event_loop_mu_.Release();
}
server_.Shutdown();
@@ -68,21 +63,15 @@ void ServerThread::WaitForCryptoHandshakeConfirmed() {
}
void ServerThread::Pause() {
- DCHECK(!pause_.IsSignaled());
- pause_.Signal();
- paused_.Wait();
+ event_loop_mu_.Acquire();
}
void ServerThread::Resume() {
- DCHECK(!resume_.IsSignaled());
- DCHECK(pause_.IsSignaled());
- resume_.Signal();
+ event_loop_mu_.AssertAcquired(); // Checks the calling thread only!
+ event_loop_mu_.Release();
}
void ServerThread::Quit() {
- if (pause_.IsSignaled() && !resume_.IsSignaled()) {
- resume_.Signal();
- }
quit_.Signal();
}
« no previous file with comments | « net/tools/quic/test_tools/server_thread.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698