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

Unified Diff: sandbox/linux/services/thread_helpers.h

Issue 935333002: Update from https://crrev.com/316786 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sandbox/linux/services/syscall_wrappers.cc ('k') | sandbox/linux/services/thread_helpers.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sandbox/linux/services/thread_helpers.h
diff --git a/sandbox/linux/services/thread_helpers.h b/sandbox/linux/services/thread_helpers.h
index 377742a539acd4abb169ca400c0dcfabc3a74c37..efc24589224e4989f2b1a4bc0cebc0ae4183c053 100644
--- a/sandbox/linux/services/thread_helpers.h
+++ b/sandbox/linux/services/thread_helpers.h
@@ -15,18 +15,26 @@ namespace sandbox {
class SANDBOX_EXPORT ThreadHelpers {
public:
// Check whether the current process is single threaded. |proc_self_tasks|
- // can be a file descriptor to /proc/self/task/ and remains owned by the
- // caller or -1.
- // If |proc_self_tasks| is -1, this method will open /proc/self/task/ and
- // crash if it cannot.
+ // must be a file descriptor to /proc/self/task/ and remains owned by the
+ // caller.
static bool IsSingleThreaded(int proc_self_task);
+ static bool IsSingleThreaded();
+
+ // Crash if the current process is not single threaded. This will wait
+ // on /proc to be updated. In the case where this doesn't crash, this will
+ // return promptly. In the case where this does crash, this will first wait
+ // for a few ms in Debug mode, a few seconds in Release mode.
+ static void AssertSingleThreaded(int proc_self_task);
+ static void AssertSingleThreaded();
// Stop |thread| and ensure that it does not have an entry in
// /proc/self/task/ from the point of view of the current thread. This is
// the way to stop threads before calling IsSingleThreaded().
- static bool StopThreadAndWatchProcFS(int proc_self_tasks,
+ static bool StopThreadAndWatchProcFS(int proc_self_task,
base::Thread* thread);
+ static const char* GetAssertSingleThreadedErrorMessageForTests();
+
private:
DISALLOW_IMPLICIT_CONSTRUCTORS(ThreadHelpers);
};
« no previous file with comments | « sandbox/linux/services/syscall_wrappers.cc ('k') | sandbox/linux/services/thread_helpers.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698