2021-06-27 21:25:29 +00:00
|
|
|
/***
|
|
|
|
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_;
|
2022-01-19 17:08:13 +00:00
|
|
|
AuHashMap<AuUInt64, AuPair<void*, TlsCb>> tls_;
|
2021-06-27 21:25:29 +00:00
|
|
|
AuUInt64 fence_ = 0;
|
|
|
|
};
|
|
|
|
}
|