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 <dlfcn.h> | 9 #include <dlfcn.h> |
10 #include <errno.h> | 10 #include <errno.h> |
(...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
508 PlatformData() : thread_(kNoThread) {} | 508 PlatformData() : thread_(kNoThread) {} |
509 pthread_t thread_; // Thread handle for pthread. | 509 pthread_t thread_; // Thread handle for pthread. |
510 // Synchronizes thread creation | 510 // Synchronizes thread creation |
511 Mutex thread_creation_mutex_; | 511 Mutex thread_creation_mutex_; |
512 }; | 512 }; |
513 | 513 |
514 Thread::Thread(const Options& options) | 514 Thread::Thread(const Options& options) |
515 : data_(new PlatformData), | 515 : data_(new PlatformData), |
516 stack_size_(options.stack_size()), | 516 stack_size_(options.stack_size()), |
517 start_semaphore_(NULL) { | 517 start_semaphore_(NULL) { |
518 if (stack_size_ > 0 && stack_size_ < PTHREAD_STACK_MIN) { | 518 if (stack_size_ > 0 && static_cast<size_t>(stack_size_) < PTHREAD_STACK_MIN) { |
519 stack_size_ = PTHREAD_STACK_MIN; | 519 stack_size_ = PTHREAD_STACK_MIN; |
520 } | 520 } |
521 set_name(options.name()); | 521 set_name(options.name()); |
522 } | 522 } |
523 | 523 |
524 | 524 |
525 Thread::~Thread() { | 525 Thread::~Thread() { |
526 delete data_; | 526 delete data_; |
527 } | 527 } |
528 | 528 |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
728 | 728 |
729 void Thread::SetThreadLocal(LocalStorageKey key, void* value) { | 729 void Thread::SetThreadLocal(LocalStorageKey key, void* value) { |
730 pthread_key_t pthread_key = LocalKeyToPthreadKey(key); | 730 pthread_key_t pthread_key = LocalKeyToPthreadKey(key); |
731 int result = pthread_setspecific(pthread_key, value); | 731 int result = pthread_setspecific(pthread_key, value); |
732 DCHECK_EQ(0, result); | 732 DCHECK_EQ(0, result); |
733 USE(result); | 733 USE(result); |
734 } | 734 } |
735 | 735 |
736 | 736 |
737 } } // namespace v8::base | 737 } } // namespace v8::base |
OLD | NEW |