| 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 548 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 559 class Thread::PlatformData : public Malloced { | 559 class Thread::PlatformData : public Malloced { |
| 560 public: | 560 public: |
| 561 PlatformData() : thread_(kNoThread) {} | 561 PlatformData() : thread_(kNoThread) {} |
| 562 pthread_t thread_; // Thread handle for pthread. | 562 pthread_t thread_; // Thread handle for pthread. |
| 563 }; | 563 }; |
| 564 | 564 |
| 565 Thread::Thread(const Options& options) | 565 Thread::Thread(const Options& options) |
| 566 : data_(new PlatformData), | 566 : data_(new PlatformData), |
| 567 stack_size_(options.stack_size()), | 567 stack_size_(options.stack_size()), |
| 568 start_semaphore_(NULL) { | 568 start_semaphore_(NULL) { |
| 569 if (stack_size_ > 0 && stack_size_ < PTHREAD_STACK_MIN) { |
| 570 stack_size_ = PTHREAD_STACK_MIN; |
| 571 } |
| 569 set_name(options.name()); | 572 set_name(options.name()); |
| 570 } | 573 } |
| 571 | 574 |
| 572 | 575 |
| 573 Thread::~Thread() { | 576 Thread::~Thread() { |
| 574 delete data_; | 577 delete data_; |
| 575 } | 578 } |
| 576 | 579 |
| 577 | 580 |
| 578 static void SetThreadName(const char* name) { | 581 static void SetThreadName(const char* name) { |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 773 | 776 |
| 774 void Thread::SetThreadLocal(LocalStorageKey key, void* value) { | 777 void Thread::SetThreadLocal(LocalStorageKey key, void* value) { |
| 775 pthread_key_t pthread_key = LocalKeyToPthreadKey(key); | 778 pthread_key_t pthread_key = LocalKeyToPthreadKey(key); |
| 776 int result = pthread_setspecific(pthread_key, value); | 779 int result = pthread_setspecific(pthread_key, value); |
| 777 ASSERT_EQ(0, result); | 780 ASSERT_EQ(0, result); |
| 778 USE(result); | 781 USE(result); |
| 779 } | 782 } |
| 780 | 783 |
| 781 | 784 |
| 782 } } // namespace v8::internal | 785 } } // namespace v8::internal |
| OLD | NEW |