| 126 | } |
| 127 | |
| 128 | void* 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 |
nothing calls this directly
no test coverage detected