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 1510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1521 if (data_->thread_ != kNoThread) CloseHandle(data_->thread_); | 1521 if (data_->thread_ != kNoThread) CloseHandle(data_->thread_); |
1522 delete data_; | 1522 delete data_; |
1523 } | 1523 } |
1524 | 1524 |
1525 | 1525 |
1526 // Create a new thread. It is important to use _beginthreadex() instead of | 1526 // Create a new thread. It is important to use _beginthreadex() instead of |
1527 // the Win32 function CreateThread(), because the CreateThread() does not | 1527 // the Win32 function CreateThread(), because the CreateThread() does not |
1528 // initialize thread specific structures in the C runtime library. | 1528 // initialize thread specific structures in the C runtime library. |
1529 void Thread::Start() { | 1529 void Thread::Start() { |
1530 data_->thread_ = reinterpret_cast<HANDLE>( | 1530 data_->thread_ = reinterpret_cast<HANDLE>( |
1531 _beginthreadex(NULL, | 1531 _beginthreadex(NULL, |
Vitaly Repeshko
2011/04/12 02:40:56
Shouldn't we still assert thread creation succeede
| |
1532 static_cast<unsigned>(stack_size_), | 1532 static_cast<unsigned>(stack_size_), |
1533 ThreadEntry, | 1533 ThreadEntry, |
1534 this, | 1534 this, |
1535 0, | 1535 0, |
1536 NULL)); | 1536 NULL)); |
1537 ASSERT(IsValid()); | |
1538 } | 1537 } |
1539 | 1538 |
1540 | 1539 |
1541 // Wait for thread to terminate. | 1540 // Wait for thread to terminate. |
1542 void Thread::Join() { | 1541 void Thread::Join() { |
1543 WaitForSingleObject(data_->thread_, INFINITE); | 1542 WaitForSingleObject(data_->thread_, INFINITE); |
1544 } | 1543 } |
1545 | 1544 |
1546 | 1545 |
1547 Thread::LocalStorageKey Thread::CreateThreadLocalKey() { | 1546 Thread::LocalStorageKey Thread::CreateThreadLocalKey() { |
(...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2013 | 2012 |
2014 void Sampler::Stop() { | 2013 void Sampler::Stop() { |
2015 ASSERT(IsActive()); | 2014 ASSERT(IsActive()); |
2016 SamplerThread::RemoveActiveSampler(this); | 2015 SamplerThread::RemoveActiveSampler(this); |
2017 SetActive(false); | 2016 SetActive(false); |
2018 } | 2017 } |
2019 | 2018 |
2020 #endif // ENABLE_LOGGING_AND_PROFILING | 2019 #endif // ENABLE_LOGGING_AND_PROFILING |
2021 | 2020 |
2022 } } // namespace v8::internal | 2021 } } // namespace v8::internal |
OLD | NEW |