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

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

Issue 226083005: Linux sandbox: componentize almost everything. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Update dependencies. Created 6 years, 8 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 | « sandbox/linux/services/scoped_process.h ('k') | sandbox/linux/services/yama.h » ('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 #ifndef SANDBOX_LINUX_SERVICES_THREAD_HELPERS_H_ 5 #ifndef SANDBOX_LINUX_SERVICES_THREAD_HELPERS_H_
6 #define SANDBOX_LINUX_SERVICES_THREAD_HELPERS_H_ 6 #define SANDBOX_LINUX_SERVICES_THREAD_HELPERS_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "sandbox/linux/sandbox_export.h"
9 10
10 namespace base { class Thread; } 11 namespace base { class Thread; }
11 12
12 namespace sandbox { 13 namespace sandbox {
13 14
14 class ThreadHelpers { 15 class SANDBOX_EXPORT ThreadHelpers {
15 public: 16 public:
16 // Check whether the current process is single threaded. |proc_self_tasks| 17 // Check whether the current process is single threaded. |proc_self_tasks|
17 // can be a file descriptor to /proc/self/task/ and remains owned by the 18 // can be a file descriptor to /proc/self/task/ and remains owned by the
18 // caller or -1. 19 // caller or -1.
19 // If |proc_self_tasks| is -1, this method will open /proc/self/task/ and 20 // If |proc_self_tasks| is -1, this method will open /proc/self/task/ and
20 // crash if it cannot. 21 // crash if it cannot.
21 static bool IsSingleThreaded(int proc_self_task); 22 static bool IsSingleThreaded(int proc_self_task);
22 23
23 // Stop |thread| and ensure that it does not have an entry in 24 // Stop |thread| and ensure that it does not have an entry in
24 // /proc/self/task/ from the point of view of the current thread. This is 25 // /proc/self/task/ from the point of view of the current thread. This is
25 // the way to stop threads before calling IsSingleThreaded(). 26 // the way to stop threads before calling IsSingleThreaded().
26 static bool StopThreadAndWatchProcFS(int proc_self_tasks, 27 static bool StopThreadAndWatchProcFS(int proc_self_tasks,
27 base::Thread* thread); 28 base::Thread* thread);
28 29
29 private: 30 private:
30 DISALLOW_IMPLICIT_CONSTRUCTORS(ThreadHelpers); 31 DISALLOW_IMPLICIT_CONSTRUCTORS(ThreadHelpers);
31 }; 32 };
32 33
33 } // namespace sandbox 34 } // namespace sandbox
34 35
35 #endif // SANDBOX_LINUX_SERVICES_THREAD_HELPERS_H_ 36 #endif // SANDBOX_LINUX_SERVICES_THREAD_HELPERS_H_
OLDNEW
« no previous file with comments | « sandbox/linux/services/scoped_process.h ('k') | sandbox/linux/services/yama.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698