summaryrefslogtreecommitdiffstats
path: root/src/utils.cc
diff options
context:
space:
mode:
authorIan Rogers <irogers@google.com>2012-09-28 17:17:10 -0700
committerIan Rogers <irogers@google.com>2012-10-03 17:29:26 -0700
commit120f1c74a9768e958377b6c97897511b27ae58c8 (patch)
treefa1f90d88ea34d8ef9eec729d27c7a70956a6a09 /src/utils.cc
parentcabc60e71a65fa17e5a99fba94fc61523fbeb478 (diff)
downloadart-120f1c74a9768e958377b6c97897511b27ae58c8.zip
art-120f1c74a9768e958377b6c97897511b27ae58c8.tar.gz
art-120f1c74a9768e958377b6c97897511b27ae58c8.tar.bz2
Fail threads attaching during runtime shutdown.
Introduce counters to indicate that threads are being born. Don't allow thread birth to occur during runtime shutdown. Bug: 7000936 Change-Id: Ib0d78f78c0ff126a4b5d3b5a6f1a2ff8f5061ae9
Diffstat (limited to 'src/utils.cc')
-rw-r--r--src/utils.cc8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/utils.cc b/src/utils.cc
index 534b28e..cbe07a2 100644
--- a/src/utils.cc
+++ b/src/utils.cc
@@ -73,10 +73,10 @@ std::string GetThreadName(pid_t tid) {
return result;
}
-void GetThreadStack(void*& stack_base, size_t& stack_size) {
+void GetThreadStack(pthread_t thread, void*& stack_base, size_t& stack_size) {
#if defined(__APPLE__)
- stack_size = pthread_get_stacksize_np(pthread_self());
- void* stack_addr = pthread_get_stackaddr_np(pthread_self());
+ stack_size = pthread_get_stacksize_np(thread);
+ void* stack_addr = pthread_get_stackaddr_np(thread);
// Check whether stack_addr is the base or end of the stack.
// (On Mac OS 10.7, it's the end.)
@@ -88,7 +88,7 @@ void GetThreadStack(void*& stack_base, size_t& stack_size) {
}
#else
pthread_attr_t attributes;
- CHECK_PTHREAD_CALL(pthread_getattr_np, (pthread_self(), &attributes), __FUNCTION__);
+ CHECK_PTHREAD_CALL(pthread_getattr_np, (thread, &attributes), __FUNCTION__);
CHECK_PTHREAD_CALL(pthread_attr_getstack, (&attributes, &stack_base, &stack_size), __FUNCTION__);
CHECK_PTHREAD_CALL(pthread_attr_destroy, (&attributes), __FUNCTION__);
#endif