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

Side by Side Diff: third_party/re2/util/thread.cc

Issue 10575037: Include RE2 library (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Less intrusive fix for Android Created 8 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « third_party/re2/util/thread.h ('k') | third_party/re2/util/utf.h » ('j') | 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 2009 The RE2 Authors. All Rights Reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
4
5 #include <pthread.h>
6
7 #include "util/util.h"
8 #include "util/thread.h"
9
10 Thread::Thread() {
11 pid_ = 0;
12 running_ = 0;
13 joinable_ = 0;
14 }
15
16 Thread::~Thread() {
17 }
18
19 void *startThread(void *v) {
20 Thread* t = (Thread*)v;
21 t->Run();
22 return 0;
23 }
24
25 void Thread::Start() {
26 CHECK(!running_);
27 pthread_create(&pid_, 0, startThread, this);
28 running_ = true;
29 if (!joinable_)
30 pthread_detach(pid_);
31 }
32
33 void Thread::Join() {
34 CHECK(running_);
35 CHECK(joinable_);
36 void *val;
37 pthread_join(pid_, &val);
38 running_ = 0;
39 }
40
41 void Thread::SetJoinable(bool j) {
42 CHECK(!running_);
43 joinable_ = j;
44 }
OLDNEW
« no previous file with comments | « third_party/re2/util/thread.h ('k') | third_party/re2/util/utf.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698