summaryrefslogtreecommitdiff
path: root/runtime/monitor_test.cc
diff options
context:
space:
mode:
author Mathieu Chartier <mathieuc@google.com> 2015-09-03 16:13:34 -0700
committer Mathieu Chartier <mathieuc@google.com> 2015-09-03 17:33:19 -0700
commitf1d666e1b48f8070ef1177fce156c08827f08eb8 (patch)
tree772cbbe6652b32ea2be31532156295db27579390 /runtime/monitor_test.cc
parent897ce64153e4758663e464fb5fb339f9a7b496c8 (diff)
Add ScopedThreadSuspension
Fixes the TransitionFromRunnableToSuspended and TransitionFromSuspendedToRunnable pattern that was prone to errors. Change-Id: Ie6ae9c0357c83b4fc4899d05dfa0975553170267
Diffstat (limited to 'runtime/monitor_test.cc')
-rw-r--r--runtime/monitor_test.cc3
1 files changed, 1 insertions, 2 deletions
diff --git a/runtime/monitor_test.cc b/runtime/monitor_test.cc
index 69112b18ec..83e0c0dea9 100644
--- a/runtime/monitor_test.cc
+++ b/runtime/monitor_test.cc
@@ -316,7 +316,7 @@ static void CommonWaitSetup(MonitorTest* test, ClassLinker* class_linker, uint64
}
// Need to drop the mutator lock to allow barriers.
- soa.Self()->TransitionFromRunnableToSuspended(kNative);
+ ScopedThreadSuspension sts(soa.Self(), kNative);
ThreadPool thread_pool(pool_name, 3);
thread_pool.AddTask(self, new CreateTask(test, create_sleep, c_millis, c_expected));
if (interrupt) {
@@ -340,7 +340,6 @@ static void CommonWaitSetup(MonitorTest* test, ClassLinker* class_linker, uint64
}
thread_pool.StopWorkers(self);
- soa.Self()->TransitionFromSuspendedToRunnable();
}