OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #if defined(OS_WIN) | 5 #if defined(OS_WIN) |
6 #include <windows.h> | 6 #include <windows.h> |
7 #include <process.h> | 7 #include <process.h> |
8 #endif | 8 #endif |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 threads[index]->Join(); | 120 threads[index]->Join(); |
121 delete threads[index]; | 121 delete threads[index]; |
122 delete thread_delegates[index]; | 122 delete thread_delegates[index]; |
123 | 123 |
124 // Verify that the destructor was called and that we reset. | 124 // Verify that the destructor was called and that we reset. |
125 EXPECT_EQ(values[index], kFinalTlsValue); | 125 EXPECT_EQ(values[index], kFinalTlsValue); |
126 } | 126 } |
127 tls_slot.Free(); // Stop doing callbacks to cleanup threads. | 127 tls_slot.Free(); // Stop doing callbacks to cleanup threads. |
128 } | 128 } |
129 | 129 |
| 130 TEST(ThreadLocalStorageTest, TLSReclaim) { |
| 131 // Creates and destroys many TLS slots. |
| 132 for (int i = 0; i < 1000; ++i) { |
| 133 ThreadLocalStorage::Slot slot(nullptr); |
| 134 } |
| 135 } |
| 136 |
130 } // namespace base | 137 } // namespace base |
OLD | NEW |