1 // Copyright 2011 The Chromium Authors 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #include "net/base/winsock_util.h" 6 7 #include "base/check_op.h" 8 9 namespace net { 10 ResetEventIfSignaled(WSAEVENT hEvent)11bool ResetEventIfSignaled(WSAEVENT hEvent) { 12 DWORD wait_rv = WaitForSingleObject(hEvent, 0); 13 if (wait_rv == WAIT_TIMEOUT) 14 return false; // The event object is not signaled. 15 DCHECK_EQ(wait_rv, static_cast<DWORD>(WAIT_OBJECT_0)); 16 BOOL ok = WSAResetEvent(hEvent); 17 DCHECK(ok); 18 return true; 19 } 20 21 } // namespace net 22