From 120f1c74a9768e958377b6c97897511b27ae58c8 Mon Sep 17 00:00:00 2001 From: Ian Rogers Date: Fri, 28 Sep 2012 17:17:10 -0700 Subject: 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 --- src/utils.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/utils.cc') 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 -- cgit v1.1