| 57 | int32_atomic_t g_NextTlsIndex = 0; |
| 58 | |
| 59 | static void TlsThreadFunction(void* arg) |
| 60 | { |
| 61 | uintptr_t n = (uintptr_t) arg; |
| 62 | |
| 63 | void* data = dmThread::GetTlsValue(g_TlsKey); |
| 64 | assert(data == 0); |
| 65 | int32_t i = dmAtomicIncrement32(&g_NextTlsIndex); |
| 66 | data = &g_TlsData[i]; |
| 67 | dmThread::SetTlsValue(g_TlsKey, data); |
| 68 | |
| 69 | for (uintptr_t i = 0; i < n; ++i) |
| 70 | { |
| 71 | int* tls_data = (int*) dmThread::GetTlsValue(g_TlsKey); |
| 72 | *tls_data = *tls_data + 1; |
| 73 | } |
| 74 | } |
| 75 | |
| 76 | TEST(Thread, Tls) |
| 77 | { |
nothing calls this directly
no test coverage detected