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

Unified Diff: mojo/edk/system/cond_var.h

Issue 1426343002: EDK: Move mutex.*, cond_var.*, and thread_annotations.h to //mojo/edk/util. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: oops Created 5 years, 1 month 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 | « mojo/edk/system/channel_manager.cc ('k') | mojo/edk/system/cond_var.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/edk/system/cond_var.h
diff --git a/mojo/edk/system/cond_var.h b/mojo/edk/system/cond_var.h
deleted file mode 100644
index 1d0497289a89608bb4323e56331d12d5ba426d54..0000000000000000000000000000000000000000
--- a/mojo/edk/system/cond_var.h
+++ /dev/null
@@ -1,66 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// A condition variable class (to be used with |mojo::system::Mutex|).
-
-#ifndef MOJO_EDK_SYSTEM_COND_VAR_H_
-#define MOJO_EDK_SYSTEM_COND_VAR_H_
-
-#include <pthread.h>
-#include <stdint.h>
-
-#include "mojo/edk/system/thread_annotations.h"
-#include "mojo/public/cpp/system/macros.h"
-
-namespace mojo {
-namespace system {
-
-class Mutex;
-
-class CondVar {
- public:
- CondVar();
- ~CondVar();
-
- // Atomically releases |*mutex| (which must be held) and blocks on this
- // condition variable, unlocking and reacquiring |*mutex| when:
- // * |SignalAll()| is called,
- // * |Signal()| is called and this thread is scheduled to be the next to be
- // unblocked, or
- // * whenever (spuriously, e.g., due to |EINTR|).
- // To deal with spurious wakeups, wait using a loop (with |my_mutex| held):
- // while (!<my_condition>)
- // cv.Wait(&my_mutex);
- void Wait(Mutex* mutex) MOJO_EXCLUSIVE_LOCKS_REQUIRED(mutex);
-
- // Like |Wait()|, but will also unblock when |timeout_microseconds| have
- // elapsed without this condition variable being signaled. Returns true on
- // timeout; this is somewhat counterintuitive, but the false case is
- // non-specific: the condition variable may or may not have been signaled and
- // |timeout_microseconds| may or may not have already elapsed (spurious
- // wakeups are possible).
- // TODO(vtl): A version with an absolute deadline time would be more efficient
- // for users who want to wait to be signaled or a timeout to have definitely
- // elapsed. With this API, users have to recalculate the timeout when they
- // detect a spurious wakeup.
- bool WaitWithTimeout(Mutex* mutex, uint64_t timeout_microseconds)
- MOJO_EXCLUSIVE_LOCKS_REQUIRED(mutex);
-
- // Signals this condition variable, waking at least one waiting thread if
- // there are any.
- void Signal();
-
- // Signals this condition variable, waking all waiting threads.
- void SignalAll();
-
- private:
- pthread_cond_t impl_;
-
- MOJO_DISALLOW_COPY_AND_ASSIGN(CondVar);
-};
-
-} // namespace system
-} // namespace mojo
-
-#endif // MOJO_EDK_SYSTEM_COND_VAR_H_
« no previous file with comments | « mojo/edk/system/channel_manager.cc ('k') | mojo/edk/system/cond_var.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698