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 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
485 | 485 |
486 void OS::StrNCpy(char* dest, int length, const char* src, size_t n) { | 486 void OS::StrNCpy(char* dest, int length, const char* src, size_t n) { |
487 strncpy(dest, src, n); | 487 strncpy(dest, src, n); |
488 } | 488 } |
489 | 489 |
490 | 490 |
491 // ---------------------------------------------------------------------------- | 491 // ---------------------------------------------------------------------------- |
492 // POSIX thread support. | 492 // POSIX thread support. |
493 // | 493 // |
494 | 494 |
495 class Thread::PlatformData : public Malloced { | 495 class Thread::PlatformData { |
496 public: | 496 public: |
497 PlatformData() : thread_(kNoThread) {} | 497 PlatformData() : thread_(kNoThread) {} |
498 pthread_t thread_; // Thread handle for pthread. | 498 pthread_t thread_; // Thread handle for pthread. |
499 // Synchronizes thread creation | 499 // Synchronizes thread creation |
500 Mutex thread_creation_mutex_; | 500 Mutex thread_creation_mutex_; |
501 }; | 501 }; |
502 | 502 |
503 Thread::Thread(const Options& options) | 503 Thread::Thread(const Options& options) |
504 : data_(new PlatformData), | 504 : data_(new PlatformData), |
505 stack_size_(options.stack_size()), | 505 stack_size_(options.stack_size()), |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
717 | 717 |
718 void Thread::SetThreadLocal(LocalStorageKey key, void* value) { | 718 void Thread::SetThreadLocal(LocalStorageKey key, void* value) { |
719 pthread_key_t pthread_key = LocalKeyToPthreadKey(key); | 719 pthread_key_t pthread_key = LocalKeyToPthreadKey(key); |
720 int result = pthread_setspecific(pthread_key, value); | 720 int result = pthread_setspecific(pthread_key, value); |
721 ASSERT_EQ(0, result); | 721 ASSERT_EQ(0, result); |
722 USE(result); | 722 USE(result); |
723 } | 723 } |
724 | 724 |
725 | 725 |
726 } } // namespace v8::internal | 726 } } // namespace v8::internal |
OLD | NEW |