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

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

Issue 893993004: Linux sandbox: Provide AssertSingleThreaded() helper (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Only run death test in Debug mode. 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/seccomp-bpf/sandbox_bpf.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..88360afb567f108f4f7ebd7cfb1af3b78616a595 100644
--- a/sandbox/linux/services/thread_helpers.h
+++ b/sandbox/linux/services/thread_helpers.h
@@ -21,12 +21,22 @@ class SANDBOX_EXPORT ThreadHelpers {
// crash if it cannot.
static bool IsSingleThreaded(int proc_self_task);
+ // 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.
+ // If |proc_self_tasks| is -1, this method will open /proc/self/task/ and
+ // crash if it cannot.
+ static void AssertSingleThreaded(int proc_self_task);
+
// 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/seccomp-bpf/sandbox_bpf.cc ('k') | sandbox/linux/services/thread_helpers.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698