MCPcopy Create free account
hub / github.com/chen3feng/toft / StaticEntry

Method StaticEntry

system/threading/base_thread.cpp:128–151  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

126}
127
128void* BaseThread::StaticEntry(void* param)
129{
130 BaseThread* base_thread = static_cast<BaseThread*>(param);
131 bool detached = base_thread->m_attributes.IsDetached();
132 if (!detached) {
133 base_thread->m_is_alive = true;
134 base_thread->m_id = ThisThread::GetId();
135 }
136 const std::string& name = base_thread->m_attributes.m_name;
137 if (!name.empty()) {
138 // Set thread name for easy debugging.
139#if __GLIBC__ > 2 || __GLIBC__ == 2 && __GLIBC_MINOR__ >= 12
140 pthread_setname_np(pthread_self(), name.c_str());
141#else
142 prctl(PR_SET_NAME, name.c_str(), 0, 0, 0);
143#endif
144 }
145 pthread_cleanup_push(Cleanup, param);
146 base_thread->Entry();
147 base_thread->m_is_alive = false;
148 pthread_cleanup_pop(true);
149
150 return 0;
151}
152
153} // namespace toft

Callers

nothing calls this directly

Calls 3

IsDetachedMethod · 0.80
emptyMethod · 0.45
EntryMethod · 0.45

Tested by

no test coverage detected