AuroraRuntime/Source/Threading/Threads/TLSView.hpp
2021-06-27 22:25:29 +01:00

28 lines
689 B
C++

/***
Copyright (C) 2021 J Reece Wilson (a/k/a "Reece"). All rights reserved.
File: TLSView.hpp
Date: 2021-6-12
Author: Reece
***/
#pragma once
namespace Aurora::Threading::Threads
{
class TLSViewImpl : public TLSView
{
public:
~TLSViewImpl();
void Remove(AuUInt64 key) override;
void *GetTLS(AuUInt64 key, AuMach length, bool noAutoCreate) override;
void *InitTLS(AuUInt64 key, AuMach length, const TlsCb &init, const TlsCb &deinit) override;
private:
void ConsiderRehash();
Primitives::SpinLock lock_;
AuHashMap<AuUInt64, std::pair<void*, TlsCb>> tls_;
AuUInt64 fence_ = 0;
};
}