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

Side by Side Diff: tools/android/forwarder2/thread.cc

Issue 10918057: Add forwarder2 (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 3 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 unified diff | Download patch
« no previous file with comments | « tools/android/forwarder2/thread.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2012 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.
4
5 #include "tools/android/forwarder2/thread.h"
6
7 #include "base/logging.h"
8
9 namespace forwarder {
10
11 Thread::Thread() : thread_(static_cast<pthread_t>(-1)) {}
12
13 Thread::~Thread() {}
14
15 void Thread::Start() {
16 CHECK_EQ(0, pthread_create(&thread_, NULL, &ThreadCallback, this));
17 }
18
19 void Thread::Join() {
20 CHECK_NE(static_cast<pthread_t>(-1), thread_);
21 CHECK_EQ(0, pthread_join(thread_, NULL));
22 }
23
24 // static
25 void* Thread::ThreadCallback(void* arg) {
26 CHECK(arg);
27 Thread* obj = reinterpret_cast<Thread*>(arg);
28 obj->Run();
29 return NULL;
30 }
31
32 } // namespace forwarder
OLDNEW
« no previous file with comments | « tools/android/forwarder2/thread.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698