mirror of
https://github.com/SysRay/psOff_public.git
synced 2024-11-27 00:20:54 +00:00
+pthread_cancel, call tls destructor != nullptr
This commit is contained in:
parent
f75fc735d3
commit
90afd34de2
@ -802,10 +802,8 @@ int cancel(ScePthread_obj obj) {
|
||||
auto thread = getPthread(obj);
|
||||
// todo cancel
|
||||
// int result = ::pthread_cancel(thread->p);
|
||||
|
||||
LOG_USE_MODULE(pthread);
|
||||
LOG_ERR(L" todo cancel| %S id:%d", thread->name.data(), thread->unique_id);
|
||||
// LOG_TRACE(L"thread cancel| threadId:%d name:%S result:%d", thread->unique_id, thread->name.c_str(), result);
|
||||
thread->p.interrupt();
|
||||
join(obj, nullptr);
|
||||
|
||||
return Ok;
|
||||
}
|
||||
@ -1219,6 +1217,7 @@ void cleanup_thread() {
|
||||
func(arg);
|
||||
thread->cleanupFuncs.pop_back();
|
||||
}
|
||||
accessRuntimeLinker().destroyTLSKeys(getSelf());
|
||||
|
||||
auto thread_dtors = *getThreadDtors();
|
||||
|
||||
@ -1226,8 +1225,6 @@ void cleanup_thread() {
|
||||
thread_dtors();
|
||||
}
|
||||
|
||||
accessRuntimeLinker().destroyTLSKeys(getSelf());
|
||||
|
||||
accessMemoryManager()->unregisterStack((uint64_t)thread->attr.getStackAddr());
|
||||
|
||||
// Delete here if detached, else in join()
|
||||
|
@ -691,13 +691,13 @@ void RuntimeLinker::destroyTLSKeys(uint8_t* obj) {
|
||||
|
||||
std::unique_lock const lock(m_mutex_int);
|
||||
|
||||
m_threadList.erase(pthread::getThreadId(obj));
|
||||
|
||||
for (uint64_t n = m_countcreatePrograms; n < m_dtvKeys.size(); ++n, ++pDtvKey) {
|
||||
if (m_dtvKeys[n].destructor != nullptr) {
|
||||
m_dtvKeys[n].destructor((void*)pDtvKey[n]);
|
||||
if (pDtvKey[n] != 0) m_dtvKeys[n].destructor((void*)pDtvKey[n]);
|
||||
}
|
||||
}
|
||||
|
||||
m_threadList.erase(pthread::getThreadId(obj));
|
||||
}
|
||||
|
||||
void RuntimeLinker::stopModules() {
|
||||
|
Loading…
Reference in New Issue
Block a user