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

Side by Side Diff: sandbox/linux/services/thread_helpers.cc

Issue 1207823004: PlatformThreadHandle: remove public id() interface (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: the last two nits Created 5 years, 5 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 | « media/midi/midi_manager_win.cc ('k') | win8/test/open_with_dialog_async.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "sandbox/linux/services/thread_helpers.h" 5 #include "sandbox/linux/services/thread_helpers.h"
6 6
7 #include <errno.h> 7 #include <errno.h>
8 #include <fcntl.h> 8 #include <fcntl.h>
9 #include <signal.h> 9 #include <signal.h>
10 #include <sys/types.h> 10 #include <sys/types.h>
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 void ThreadHelpers::AssertSingleThreaded() { 125 void ThreadHelpers::AssertSingleThreaded() {
126 base::ScopedFD task_fd(ProcUtil::OpenProc()); 126 base::ScopedFD task_fd(ProcUtil::OpenProc());
127 AssertSingleThreaded(task_fd.get()); 127 AssertSingleThreaded(task_fd.get());
128 } 128 }
129 129
130 // static 130 // static
131 bool ThreadHelpers::StopThreadAndWatchProcFS(int proc_fd, 131 bool ThreadHelpers::StopThreadAndWatchProcFS(int proc_fd,
132 base::Thread* thread) { 132 base::Thread* thread) {
133 DCHECK_LE(0, proc_fd); 133 DCHECK_LE(0, proc_fd);
134 DCHECK(thread); 134 DCHECK(thread);
135 const base::PlatformThreadId thread_id = thread->thread_id(); 135 const base::PlatformThreadId thread_id = thread->GetThreadId();
136 const std::string thread_id_dir_str = 136 const std::string thread_id_dir_str =
137 "self/task/" + base::IntToString(thread_id) + "/"; 137 "self/task/" + base::IntToString(thread_id) + "/";
138 138
139 // The kernel is at liberty to wake the thread id futex before updating 139 // The kernel is at liberty to wake the thread id futex before updating
140 // /proc. Following Stop(), the thread is joined, but entries in /proc may 140 // /proc. Following Stop(), the thread is joined, but entries in /proc may
141 // not have been updated. 141 // not have been updated.
142 thread->Stop(); 142 thread->Stop();
143 143
144 const base::Callback<bool(void)> cb = 144 const base::Callback<bool(void)> cb =
145 base::Bind(&IsThreadPresentInProcFS, proc_fd, thread_id_dir_str); 145 base::Bind(&IsThreadPresentInProcFS, proc_fd, thread_id_dir_str);
146 146
147 RunWhileTrue(cb); 147 RunWhileTrue(cb);
148 148
149 return true; 149 return true;
150 } 150 }
151 151
152 // static 152 // static
153 const char* ThreadHelpers::GetAssertSingleThreadedErrorMessageForTests() { 153 const char* ThreadHelpers::GetAssertSingleThreadedErrorMessageForTests() {
154 return kAssertSingleThreadedError; 154 return kAssertSingleThreadedError;
155 } 155 }
156 156
157 } // namespace sandbox 157 } // namespace sandbox
OLDNEW
« no previous file with comments | « media/midi/midi_manager_win.cc ('k') | win8/test/open_with_dialog_async.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698