! \return get a thread local singleton */
| 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 */ |
nothing calls this directly
no test coverage detected