OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
577 | 577 |
578 Thread::~Thread() { | 578 Thread::~Thread() { |
579 } | 579 } |
580 | 580 |
581 | 581 |
582 static void* ThreadEntry(void* arg) { | 582 static void* ThreadEntry(void* arg) { |
583 Thread* thread = reinterpret_cast<Thread*>(arg); | 583 Thread* thread = reinterpret_cast<Thread*>(arg); |
584 // This is also initialized by the first argument to pthread_create() but we | 584 // This is also initialized by the first argument to pthread_create() but we |
585 // don't know which thread will run first (the original thread or the new | 585 // don't know which thread will run first (the original thread or the new |
586 // one) so we initialize it here too. | 586 // one) so we initialize it here too. |
587 prctl(PR_SET_NAME, thread->name(), 0, 0, 0); | 587 prctl(PR_SET_NAME, reinterpret_cast<unsigned long>(thread->name()), 0, 0, 0); |
588 thread->thread_handle_data()->thread_ = pthread_self(); | 588 thread->thread_handle_data()->thread_ = pthread_self(); |
589 ASSERT(thread->IsValid()); | 589 ASSERT(thread->IsValid()); |
590 thread->Run(); | 590 thread->Run(); |
591 return NULL; | 591 return NULL; |
592 } | 592 } |
593 | 593 |
594 | 594 |
595 void Thread::set_name(const char* name) { | 595 void Thread::set_name(const char* name) { |
596 strncpy(name_, name, sizeof(name_)); | 596 strncpy(name_, name, sizeof(name_)); |
597 name_[sizeof(name_) - 1] = '\0'; | 597 name_[sizeof(name_) - 1] = '\0'; |
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
972 } | 972 } |
973 | 973 |
974 // This sampler is no longer the active sampler. | 974 // This sampler is no longer the active sampler. |
975 active_sampler_ = NULL; | 975 active_sampler_ = NULL; |
976 } | 976 } |
977 | 977 |
978 | 978 |
979 #endif // ENABLE_LOGGING_AND_PROFILING | 979 #endif // ENABLE_LOGGING_AND_PROFILING |
980 | 980 |
981 } } // namespace v8::internal | 981 } } // namespace v8::internal |
OLD | NEW |