Index: src/platform-linux.cc |
diff --git a/src/platform-linux.cc b/src/platform-linux.cc |
index 438de226297bffebeff48e36b5d4a05475645112..245dae4ace59025f855f0a65b2d6dfd29e194857 100644 |
--- a/src/platform-linux.cc |
+++ b/src/platform-linux.cc |
@@ -75,10 +75,6 @@ |
namespace v8 { |
namespace internal { |
-// 0 is never a valid thread id on Linux since tids and pids share a |
-// name space and pid 0 is reserved (see man 2 kill). |
-static const pthread_t kNoThread = (pthread_t) 0; |
- |
double ceiling(double x) { |
return ceil(x); |
@@ -711,101 +707,6 @@ bool VirtualMemory::HasLazyCommits() { |
} |
-class Thread::PlatformData : public Malloced { |
- public: |
- PlatformData() : thread_(kNoThread) {} |
- |
- pthread_t thread_; // Thread handle for pthread. |
-}; |
- |
-Thread::Thread(const Options& options) |
- : data_(new PlatformData()), |
- stack_size_(options.stack_size()), |
- start_semaphore_(NULL) { |
- set_name(options.name()); |
-} |
- |
- |
-Thread::~Thread() { |
- delete data_; |
-} |
- |
- |
-static void* ThreadEntry(void* arg) { |
- Thread* thread = reinterpret_cast<Thread*>(arg); |
- // This is also initialized by the first argument to pthread_create() but we |
- // don't know which thread will run first (the original thread or the new |
- // one) so we initialize it here too. |
-#ifdef PR_SET_NAME |
- prctl(PR_SET_NAME, |
- reinterpret_cast<unsigned long>(thread->name()), // NOLINT |
- 0, 0, 0); |
-#endif |
- thread->data()->thread_ = pthread_self(); |
- ASSERT(thread->data()->thread_ != kNoThread); |
- thread->NotifyStartedAndRun(); |
- return NULL; |
-} |
- |
- |
-void Thread::set_name(const char* name) { |
- strncpy(name_, name, sizeof(name_)); |
- name_[sizeof(name_) - 1] = '\0'; |
-} |
- |
- |
-void Thread::Start() { |
- pthread_attr_t* attr_ptr = NULL; |
-#if defined(__native_client__) |
- // use default stack size. |
-#else |
- pthread_attr_t attr; |
- if (stack_size_ > 0) { |
- pthread_attr_init(&attr); |
- pthread_attr_setstacksize(&attr, static_cast<size_t>(stack_size_)); |
- attr_ptr = &attr; |
- } |
-#endif |
- int result = pthread_create(&data_->thread_, attr_ptr, ThreadEntry, this); |
- CHECK_EQ(0, result); |
- ASSERT(data_->thread_ != kNoThread); |
-} |
- |
- |
-void Thread::Join() { |
- pthread_join(data_->thread_, NULL); |
-} |
- |
- |
-Thread::LocalStorageKey Thread::CreateThreadLocalKey() { |
- pthread_key_t key; |
- int result = pthread_key_create(&key, NULL); |
- USE(result); |
- ASSERT(result == 0); |
- return static_cast<LocalStorageKey>(key); |
-} |
- |
- |
-void Thread::DeleteThreadLocalKey(LocalStorageKey key) { |
- pthread_key_t pthread_key = static_cast<pthread_key_t>(key); |
- int result = pthread_key_delete(pthread_key); |
- USE(result); |
- ASSERT(result == 0); |
-} |
- |
- |
-void* Thread::GetThreadLocal(LocalStorageKey key) { |
- pthread_key_t pthread_key = static_cast<pthread_key_t>(key); |
- return pthread_getspecific(pthread_key); |
-} |
- |
- |
-void Thread::SetThreadLocal(LocalStorageKey key, void* value) { |
- pthread_key_t pthread_key = static_cast<pthread_key_t>(key); |
- pthread_setspecific(pthread_key, value); |
-} |
- |
- |
class LinuxSemaphore : public Semaphore { |
public: |
explicit LinuxSemaphore(int count) { sem_init(&sem_, 0, count); } |