Adding TLS abstraction.

This commit is contained in:
Ben Vanik
2015-07-15 22:20:33 -07:00
parent 48d5d76882
commit c3415e6332
3 changed files with 26 additions and 37 deletions

View File

@@ -96,6 +96,18 @@ SleepResult AlertableSleep(std::chrono::microseconds duration) {
return SleepResult::kSuccess;
}
TlsHandle AllocateTlsHandle() { return TlsAlloc(); }
bool FreeTlsHandle(TlsHandle handle) { return TlsFree(handle) ? true : false; }
uintptr_t GetTlsValue(TlsHandle handle) {
return reinterpret_cast<uintptr_t>(TlsGetValue(handle));
}
bool SetTlsValue(TlsHandle handle, uintptr_t value) {
return TlsSetValue(handle, reinterpret_cast<void*>(value)) ? true : false;
}
template <typename T>
class Win32Handle : public T {
public: