MCPcopy Create free account
hub / github.com/cinience/RedisStudio / CurrentThreadHolder

Class CurrentThreadHolder

RedisStudio/Base/Thread.h:86–109  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

84
85private:
86 class CurrentThreadHolder
87 {
88 public:
89 CurrentThreadHolder(): _slot(TlsAlloc())
90 {
91 if (_slot == TLS_OUT_OF_INDEXES)
92 throw std::exception("cannot allocate thread context key");
93 }
94 ~CurrentThreadHolder()
95 {
96 TlsFree(_slot);
97 }
98 Thread* get() const
99 {
100 return reinterpret_cast<Thread*>(TlsGetValue(_slot));
101 }
102 void set(Thread* pThread)
103 {
104 TlsSetValue(_slot, pThread);
105 }
106
107 private:
108 DWORD _slot;
109 };
110
111 Runnable* _pRunnableTarget;
112 CallbackData _callbackTarget;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected