OLD | NEW |
1 // Copyright 2006-2011 the V8 project authors. All rights reserved. | 1 // Copyright 2006-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 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
393 bool ThreadHandle::IsSelf() const { | 393 bool ThreadHandle::IsSelf() const { |
394 return pthread_equal(data_->thread_, pthread_self()); | 394 return pthread_equal(data_->thread_, pthread_self()); |
395 } | 395 } |
396 | 396 |
397 | 397 |
398 bool ThreadHandle::IsValid() const { | 398 bool ThreadHandle::IsValid() const { |
399 return data_->thread_ != kNoThread; | 399 return data_->thread_ != kNoThread; |
400 } | 400 } |
401 | 401 |
402 | 402 |
403 Thread::Thread() : ThreadHandle(ThreadHandle::INVALID) { | 403 Thread::Thread(Isolate* isolate, const Options& options) |
404 set_name("v8:<unknown>"); | 404 : ThreadHandle(ThreadHandle::INVALID), |
| 405 isolate_(isolate), |
| 406 stack_size_(options.stack_size) { |
| 407 set_name(options.name); |
405 } | 408 } |
406 | 409 |
407 | 410 |
408 Thread::Thread(const char* name) : ThreadHandle(ThreadHandle::INVALID) { | 411 Thread::Thread(Isolate* isolate, const char* name) |
| 412 : ThreadHandle(ThreadHandle::INVALID), |
| 413 isolate_(isolate), |
| 414 stack_size_(0) { |
409 set_name(name); | 415 set_name(name); |
410 } | 416 } |
411 | 417 |
412 | 418 |
413 Thread::~Thread() { | 419 Thread::~Thread() { |
414 } | 420 } |
415 | 421 |
416 | 422 |
417 static void* ThreadEntry(void* arg) { | 423 static void* ThreadEntry(void* arg) { |
418 Thread* thread = reinterpret_cast<Thread*>(arg); | 424 Thread* thread = reinterpret_cast<Thread*>(arg); |
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
736 // Release the thread handles | 742 // Release the thread handles |
737 CloseHandle(data_->sampler_thread_); | 743 CloseHandle(data_->sampler_thread_); |
738 CloseHandle(data_->profiled_thread_); | 744 CloseHandle(data_->profiled_thread_); |
739 } | 745 } |
740 | 746 |
741 | 747 |
742 #endif // ENABLE_LOGGING_AND_PROFILING | 748 #endif // ENABLE_LOGGING_AND_PROFILING |
743 | 749 |
744 } } // namespace v8::internal | 750 } } // namespace v8::internal |
745 | 751 |
OLD | NEW |