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 658 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
669 Thread::~Thread() { | 669 Thread::~Thread() { |
670 delete data_; | 670 delete data_; |
671 } | 671 } |
672 | 672 |
673 | 673 |
674 static void* ThreadEntry(void* arg) { | 674 static void* ThreadEntry(void* arg) { |
675 Thread* thread = reinterpret_cast<Thread*>(arg); | 675 Thread* thread = reinterpret_cast<Thread*>(arg); |
676 // This is also initialized by the first argument to pthread_create() but we | 676 // This is also initialized by the first argument to pthread_create() but we |
677 // don't know which thread will run first (the original thread or the new | 677 // don't know which thread will run first (the original thread or the new |
678 // one) so we initialize it here too. | 678 // one) so we initialize it here too. |
| 679 #ifdef PR_SET_NAME |
679 prctl(PR_SET_NAME, | 680 prctl(PR_SET_NAME, |
680 reinterpret_cast<unsigned long>(thread->name()), // NOLINT | 681 reinterpret_cast<unsigned long>(thread->name()), // NOLINT |
681 0, 0, 0); | 682 0, 0, 0); |
| 683 #endif |
682 thread->data()->thread_ = pthread_self(); | 684 thread->data()->thread_ = pthread_self(); |
683 ASSERT(thread->data()->thread_ != kNoThread); | 685 ASSERT(thread->data()->thread_ != kNoThread); |
684 thread->Run(); | 686 thread->Run(); |
685 return NULL; | 687 return NULL; |
686 } | 688 } |
687 | 689 |
688 | 690 |
689 void Thread::set_name(const char* name) { | 691 void Thread::set_name(const char* name) { |
690 strncpy(name_, name, sizeof(name_)); | 692 strncpy(name_, name, sizeof(name_)); |
691 name_[sizeof(name_) - 1] = '\0'; | 693 name_[sizeof(name_) - 1] = '\0'; |
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1141 | 1143 |
1142 | 1144 |
1143 void Sampler::Stop() { | 1145 void Sampler::Stop() { |
1144 ASSERT(IsActive()); | 1146 ASSERT(IsActive()); |
1145 SignalSender::RemoveActiveSampler(this); | 1147 SignalSender::RemoveActiveSampler(this); |
1146 SetActive(false); | 1148 SetActive(false); |
1147 } | 1149 } |
1148 | 1150 |
1149 | 1151 |
1150 } } // namespace v8::internal | 1152 } } // namespace v8::internal |
OLD | NEW |