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

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

Issue 1544433002: Replace RE2 import with a dependency (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Re-Added LICENSE and OWNERS file Created 5 years 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 | « third_party/re2/util/thread.cc ('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 "util/thread.h"
6 #include "util/util.h"
7
8 Thread::Thread() {
9 pid_ = 0;
10 running_ = 0;
11 joinable_ = 0;
12 }
13
14 Thread::~Thread() {
15 }
16
17 DWORD WINAPI startThread(void *v) {
18 Thread* t = (Thread*)v;
19 t->Run();
20 return 0;
21 }
22
23 void Thread::Start() {
24 CHECK(!running_);
25 pid_ = CreateThread(NULL, 0, startThread, this, 0, NULL);
26 running_ = true;
27 if (!joinable_) {
28 CloseHandle(pid_);
29 pid_ = 0;
30 }
31 }
32
33 void Thread::Join() {
34 CHECK(running_);
35 CHECK(joinable_);
36 if (pid_ != 0)
37 WaitForSingleObject(pid_, INFINITE);
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.cc ('k') | third_party/re2/util/utf.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698