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

Unified Diff: mojo/public/cpp/utility/lib/thread.cc

Issue 1784643002: Mojo C++ bindings: remove the utility/ folder. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@13_1_remove_thread_dep
Patch Set: Created 4 years, 9 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 | « mojo/public/cpp/utility/lib/run_loop.cc ('k') | mojo/public/cpp/utility/lib/thread_local.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/public/cpp/utility/lib/thread.cc
diff --git a/mojo/public/cpp/utility/lib/thread.cc b/mojo/public/cpp/utility/lib/thread.cc
deleted file mode 100644
index d9c5e523569e8b6ae5c9843f8932cc043784ecfd..0000000000000000000000000000000000000000
--- a/mojo/public/cpp/utility/lib/thread.cc
+++ /dev/null
@@ -1,66 +0,0 @@
-// Copyright 2014 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.
-
-#include "mojo/public/cpp/utility/thread.h"
-
-#include <assert.h>
-
-#include "base/compiler_specific.h"
-
-namespace mojo {
-
-Thread::Thread() : options_(), thread_(), started_(false), joined_(false) {
-}
-
-Thread::Thread(const Options& options)
- : options_(options), thread_(), started_(false), joined_(false) {
-}
-
-Thread::~Thread() {
- // If it was started, it must have been joined.
- assert(!started_ || joined_);
-}
-
-void Thread::Start() {
- assert(!started_);
- assert(!joined_);
-
- pthread_attr_t attr;
- int rv = pthread_attr_init(&attr);
- ALLOW_UNUSED_LOCAL(rv);
- assert(rv == 0);
-
- // Non-default stack size?
- if (options_.stack_size() != 0) {
- rv = pthread_attr_setstacksize(&attr, options_.stack_size());
- assert(rv == 0);
- }
-
- started_ = true;
- rv = pthread_create(&thread_, &attr, &ThreadRunTrampoline, this);
- assert(rv == 0);
-
- rv = pthread_attr_destroy(&attr);
- assert(rv == 0);
-}
-
-void Thread::Join() {
- // Must have been started but not yet joined.
- assert(started_);
- assert(!joined_);
-
- joined_ = true;
- int rv = pthread_join(thread_, nullptr);
- ALLOW_UNUSED_LOCAL(rv);
- assert(rv == 0);
-}
-
-// static
-void* Thread::ThreadRunTrampoline(void* arg) {
- Thread* self = static_cast<Thread*>(arg);
- self->Run();
- return nullptr;
-}
-
-} // namespace mojo
« no previous file with comments | « mojo/public/cpp/utility/lib/run_loop.cc ('k') | mojo/public/cpp/utility/lib/thread_local.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698