MCPcopy Create free account
hub / github.com/dmlc/dmlc-core / Get

Method Get

include/dmlc/thread_local.h:38–52  ·  view source on GitHub ↗

! \return get a thread local singleton */

Source from the content-addressed store, hash-verified

36 public:
37 /*! \return get a thread local singleton */
38 static T* Get() {
39#if DMLC_CXX11_THREAD_LOCAL && DMLC_MODERN_THREAD_LOCAL == 1
40 static thread_local T inst;
41 return &inst;
42#else
43 static MX_THREAD_LOCAL T* ptr = nullptr;
44 if (ptr == nullptr) {
45 ptr = new T();
46 // Syntactic work-around for the nvcc of the initial cuda v10.1 release,
47 // which fails to compile 'Singleton()->' below. Fixed in v10.1 update 1.
48 (*Singleton()).RegisterDelete(ptr);
49 }
50 return ptr;
51#endif
52 }
53
54 private:
55 /*! \brief constructor */

Callers

nothing calls this directly

Calls 1

RegisterDeleteMethod · 0.80

Tested by

no test coverage detected