Index: src/platform-macos.cc |
diff --git a/src/platform-macos.cc b/src/platform-macos.cc |
index df2cd672efe2f6ad28953ded029d27740d070d57..66c86c6f39d412e2f1a5124ddcd645ea689db212 100644 |
--- a/src/platform-macos.cc |
+++ b/src/platform-macos.cc |
@@ -432,16 +432,18 @@ bool ThreadHandle::IsValid() const { |
} |
-Thread::Thread(Isolate* isolate) |
+Thread::Thread(Isolate* isolate, const Options& options) |
: ThreadHandle(ThreadHandle::INVALID), |
- isolate_(isolate) { |
- set_name("v8:<unknown>"); |
+ isolate_(isolate), |
+ stack_size_(options.stack_size) { |
+ set_name(options.name); |
} |
Thread::Thread(Isolate* isolate, const char* name) |
: ThreadHandle(ThreadHandle::INVALID), |
- isolate_(isolate) { |
+ isolate_(isolate), |
+ stack_size_(0) { |
set_name(name); |
} |
@@ -450,7 +452,6 @@ Thread::~Thread() { |
} |
- |
static void SetThreadName(const char* name) { |
// pthread_setname_np is only available in 10.6 or later, so test |
// for it at runtime. |
@@ -489,7 +490,15 @@ void Thread::set_name(const char* name) { |
void Thread::Start() { |
- pthread_create(&thread_handle_data()->thread_, NULL, ThreadEntry, this); |
+ pthread_attr_t* attr_ptr = NULL; |
+ pthread_attr_t attr; |
+ if (stack_size_ > 0) { |
+ pthread_attr_init(&attr); |
+ pthread_attr_setstacksize(&attr, static_cast<size_t>(stack_size_)); |
+ attr_ptr = &attr; |
+ } |
+ pthread_create(&thread_handle_data()->thread_, attr_ptr, ThreadEntry, this); |
+ ASSERT(IsValid()); |
} |
@@ -626,7 +635,9 @@ class Sampler::PlatformData : public Malloced { |
class SamplerThread : public Thread { |
public: |
- explicit SamplerThread(int interval) : Thread(NULL), interval_(interval) {} |
+ explicit SamplerThread(int interval) |
+ : Thread(NULL, "SamplerThread"), |
+ interval_(interval) {} |
static void AddActiveSampler(Sampler* sampler) { |
ScopedLock lock(mutex_); |