MCPcopy Create free account
hub / github.com/MegEngine/MegEngine / get

Method get

src/core/include/megbrain/utils/thread_local.h:73–86  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

71 }
72
73 T** get() const {
74 if (auto d = pthread_getspecific(m_key)) {
75 return static_cast<ThreadData*>(d)->data;
76 }
77 ThreadData* t_data = new ThreadData();
78#if defined(__ANDROID__) || defined(__OHOS__)
79 get_thread_local_force_free_instance().push((void*)t_data);
80#endif
81
82 t_data->data = m_constructor();
83 t_data->self = this;
84 pthread_setspecific(m_key, t_data);
85 return t_data->data;
86 }
87
88 static void exit(void* d) {
89 ThreadData* td = static_cast<ThreadData*>(d);

Callers

nothing calls this directly

Calls 1

pushMethod · 0.45

Tested by

no test coverage detected