| 58 | |
| 59 | |
| 60 | void ThreadLocalStorageCleanup(void *value) { |
| 61 | int *ptr = reinterpret_cast<int*>(value); |
| 62 | // Destructors should never be called with a NULL. |
| 63 | ASSERT_NE(reinterpret_cast<int*>(NULL), ptr); |
| 64 | if (*ptr == kFinalTlsValue) |
| 65 | return; // We've been called enough times. |
| 66 | ASSERT_LT(kFinalTlsValue, *ptr); |
| 67 | ASSERT_GE(kFinalTlsValue + kNumberDestructorCallRepetitions, *ptr); |
| 68 | --*ptr; // Move closer to our target. |
| 69 | // Tell tls that we're not done with this thread, and still need destruction. |
| 70 | tls_slot.Set(value); |
| 71 | } |
| 72 | |
| 73 | } // namespace |
| 74 | |