1 // Copyright 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CC_BASE_COMPLETION_EVENT_H_
6 #define CC_BASE_COMPLETION_EVENT_H_
8 #include "base/logging.h"
9 #include "base/synchronization/waitable_event.h"
10 #include "base/threading/thread_restrictions.h"
14 // Used for making blocking calls from one thread to another. Use only when
15 // absolutely certain that doing-so will not lead to a deadlock.
17 // It is safe to destroy this object as soon as Wait() returns.
18 class CompletionEvent
{
21 : event_(false /* manual_reset */, false /* initially_signaled */) {
40 base::ThreadRestrictions::ScopedAllowWait allow_wait
;
53 base::WaitableEvent event_
;
55 // Used to assert that Wait() and Signal() are each called exactly once.
63 #endif // CC_BASE_COMPLETION_EVENT_H_