OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
557 class Thread::PlatformData : public Malloced { | 557 class Thread::PlatformData : public Malloced { |
558 public: | 558 public: |
559 PlatformData() : thread_(kNoThread) {} | 559 PlatformData() : thread_(kNoThread) {} |
560 pthread_t thread_; // Thread handle for pthread. | 560 pthread_t thread_; // Thread handle for pthread. |
561 }; | 561 }; |
562 | 562 |
563 Thread::Thread(const Options& options) | 563 Thread::Thread(const Options& options) |
564 : data_(new PlatformData), | 564 : data_(new PlatformData), |
565 stack_size_(options.stack_size()), | 565 stack_size_(options.stack_size()), |
566 start_semaphore_(NULL) { | 566 start_semaphore_(NULL) { |
| 567 if (stack_size_ > 0 && stack_size_ < PTHREAD_STACK_MIN) { |
| 568 stack_size_ = PTHREAD_STACK_MIN; |
| 569 } |
567 set_name(options.name()); | 570 set_name(options.name()); |
568 } | 571 } |
569 | 572 |
570 | 573 |
571 Thread::~Thread() { | 574 Thread::~Thread() { |
572 delete data_; | 575 delete data_; |
573 } | 576 } |
574 | 577 |
575 | 578 |
576 static void SetThreadName(const char* name) { | 579 static void SetThreadName(const char* name) { |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
771 | 774 |
772 void Thread::SetThreadLocal(LocalStorageKey key, void* value) { | 775 void Thread::SetThreadLocal(LocalStorageKey key, void* value) { |
773 pthread_key_t pthread_key = LocalKeyToPthreadKey(key); | 776 pthread_key_t pthread_key = LocalKeyToPthreadKey(key); |
774 int result = pthread_setspecific(pthread_key, value); | 777 int result = pthread_setspecific(pthread_key, value); |
775 ASSERT_EQ(0, result); | 778 ASSERT_EQ(0, result); |
776 USE(result); | 779 USE(result); |
777 } | 780 } |
778 | 781 |
779 | 782 |
780 } } // namespace v8::internal | 783 } } // namespace v8::internal |
OLD | NEW |