| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 694 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 705 Thread::~Thread() { | 705 Thread::~Thread() { |
| 706 delete data_; | 706 delete data_; |
| 707 } | 707 } |
| 708 | 708 |
| 709 | 709 |
| 710 static void* ThreadEntry(void* arg) { | 710 static void* ThreadEntry(void* arg) { |
| 711 Thread* thread = reinterpret_cast<Thread*>(arg); | 711 Thread* thread = reinterpret_cast<Thread*>(arg); |
| 712 // This is also initialized by the first argument to pthread_create() but we | 712 // This is also initialized by the first argument to pthread_create() but we |
| 713 // don't know which thread will run first (the original thread or the new | 713 // don't know which thread will run first (the original thread or the new |
| 714 // one) so we initialize it here too. | 714 // one) so we initialize it here too. |
| 715 #ifdef PR_SET_NAME |
| 715 prctl(PR_SET_NAME, | 716 prctl(PR_SET_NAME, |
| 716 reinterpret_cast<unsigned long>(thread->name()), // NOLINT | 717 reinterpret_cast<unsigned long>(thread->name()), // NOLINT |
| 717 0, 0, 0); | 718 0, 0, 0); |
| 719 #endif |
| 718 thread->data()->thread_ = pthread_self(); | 720 thread->data()->thread_ = pthread_self(); |
| 719 ASSERT(thread->data()->thread_ != kNoThread); | 721 ASSERT(thread->data()->thread_ != kNoThread); |
| 720 thread->Run(); | 722 thread->Run(); |
| 721 return NULL; | 723 return NULL; |
| 722 } | 724 } |
| 723 | 725 |
| 724 | 726 |
| 725 void Thread::set_name(const char* name) { | 727 void Thread::set_name(const char* name) { |
| 726 strncpy(name_, name, sizeof(name_)); | 728 strncpy(name_, name, sizeof(name_)); |
| 727 name_[sizeof(name_) - 1] = '\0'; | 729 name_[sizeof(name_) - 1] = '\0'; |
| (...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1177 | 1179 |
| 1178 | 1180 |
| 1179 void Sampler::Stop() { | 1181 void Sampler::Stop() { |
| 1180 ASSERT(IsActive()); | 1182 ASSERT(IsActive()); |
| 1181 SignalSender::RemoveActiveSampler(this); | 1183 SignalSender::RemoveActiveSampler(this); |
| 1182 SetActive(false); | 1184 SetActive(false); |
| 1183 } | 1185 } |
| 1184 | 1186 |
| 1185 | 1187 |
| 1186 } } // namespace v8::internal | 1188 } } // namespace v8::internal |
| OLD | NEW |