| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Platform-specific code for POSIX goes here. This is not a platform on its | 5 // Platform-specific code for POSIX goes here. This is not a platform on its |
| 6 // own, but contains the parts which are the same across the POSIX platforms | 6 // own, but contains the parts which are the same across the POSIX platforms |
| 7 // Linux, MacOS, FreeBSD, OpenBSD, NetBSD and QNX. | 7 // Linux, MacOS, FreeBSD, OpenBSD, NetBSD and QNX. |
| 8 | 8 |
| 9 #include <errno.h> | 9 #include <errno.h> |
| 10 #include <limits.h> | 10 #include <limits.h> |
| (...skipping 602 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 613 } | 613 } |
| 614 | 614 |
| 615 | 615 |
| 616 void Thread::Start() { | 616 void Thread::Start() { |
| 617 int result; | 617 int result; |
| 618 pthread_attr_t attr; | 618 pthread_attr_t attr; |
| 619 memset(&attr, 0, sizeof(attr)); | 619 memset(&attr, 0, sizeof(attr)); |
| 620 result = pthread_attr_init(&attr); | 620 result = pthread_attr_init(&attr); |
| 621 DCHECK_EQ(0, result); | 621 DCHECK_EQ(0, result); |
| 622 size_t stack_size = stack_size_; | 622 size_t stack_size = stack_size_; |
| 623 #if V8_OS_AIX | |
| 624 if (stack_size == 0) { | 623 if (stack_size == 0) { |
| 625 // Default on AIX is 96KB -- bump up to 2MB | 624 #if V8_OS_MACOSX |
| 625 // Default on Mac OS X is 512kB -- bump up to 1MB |
| 626 stack_size = 1 * 1024 * 1024; |
| 627 #elif V8_OS_AIX |
| 628 // Default on AIX is 96kB -- bump up to 2MB |
| 626 stack_size = 2 * 1024 * 1024; | 629 stack_size = 2 * 1024 * 1024; |
| 630 #endif |
| 627 } | 631 } |
| 628 #endif | |
| 629 if (stack_size > 0) { | 632 if (stack_size > 0) { |
| 630 result = pthread_attr_setstacksize(&attr, stack_size); | 633 result = pthread_attr_setstacksize(&attr, stack_size); |
| 631 DCHECK_EQ(0, result); | 634 DCHECK_EQ(0, result); |
| 632 } | 635 } |
| 633 { | 636 { |
| 634 LockGuard<Mutex> lock_guard(&data_->thread_creation_mutex_); | 637 LockGuard<Mutex> lock_guard(&data_->thread_creation_mutex_); |
| 635 result = pthread_create(&data_->thread_, &attr, ThreadEntry, this); | 638 result = pthread_create(&data_->thread_, &attr, ThreadEntry, this); |
| 636 } | 639 } |
| 637 DCHECK_EQ(0, result); | 640 DCHECK_EQ(0, result); |
| 638 result = pthread_attr_destroy(&attr); | 641 result = pthread_attr_destroy(&attr); |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 765 | 768 |
| 766 void Thread::SetThreadLocal(LocalStorageKey key, void* value) { | 769 void Thread::SetThreadLocal(LocalStorageKey key, void* value) { |
| 767 pthread_key_t pthread_key = LocalKeyToPthreadKey(key); | 770 pthread_key_t pthread_key = LocalKeyToPthreadKey(key); |
| 768 int result = pthread_setspecific(pthread_key, value); | 771 int result = pthread_setspecific(pthread_key, value); |
| 769 DCHECK_EQ(0, result); | 772 DCHECK_EQ(0, result); |
| 770 USE(result); | 773 USE(result); |
| 771 } | 774 } |
| 772 | 775 |
| 773 } // namespace base | 776 } // namespace base |
| 774 } // namespace v8 | 777 } // namespace v8 |
| OLD | NEW |