Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Darkstalkers Chronicle: The Chaos Tower
#15
Okay, so that thread is "Task Level0". It does indeed destroy that thread:

sceKernelTerminateThread(326)
sceKernelDeleteThread(326)
Freeing thread stack Task Level0

It's created with priority 32:
326=sceKernelCreateThread(name=Task Level0, entry=0885575c, prio=32, stacksize=12288)

But changed later:
sceKernelChangeThreadPriority(326, 63)
(while on that thread in fact.)

This code should be removing it from priority 32 initially:
Code:
int old = thread->nt.currentPriority; threadReadyQueue.remove(old, threadID);

And this code should be removing it on delete:
Code:
int prio = __KernelGetThreadPrio(threadID); if (prio != 0) threadReadyQueue.remove(prio, threadID);

One of these isn't working. So let's try changing them, respectively, to:

Code:
int old = thread->nt.currentPriority; threadReadyQueue.remove(old, threadID); NOTICE_LOG(HLE, "Removed thread %d from ready queue %d", threadID, old);

Code:
int prio = __KernelGetThreadPrio(threadID); if (prio != 0) { threadReadyQueue.remove(prio, threadID); NOTICE_LOG(HLE, "Removed thread %d from ready queue %d for delete", threadID, prio); } else { ERROR_LOG(HLE, "UNABLE TO REMOVE %d from ready queue %d for delete", threadID, prio); }

If both of those are successful, I'm not sure what's going on. We could also log here for good measure:

Code:
inline void remove(u32 priority, const SceUID threadID) { Queue *cur = &queues[priority]; _dbg_assert_msg_(SCEKERNEL, cur->next != NULL, "ThreadQueueList::Queue should already be linked up."); for (int i = cur->first; i < cur->end; ++i) { if (cur->data[i] == threadID) { int remaining = --cur->end - i; if (remaining > 0) memmove(&cur->data[i], &cur->data[i + 1], remaining * sizeof(SceUID)); return; } } // Wasn't there. }

Change to:

Code:
inline void remove(u32 priority, const SceUID threadID) { Queue *cur = &queues[priority]; _dbg_assert_msg_(SCEKERNEL, cur->next != NULL, "ThreadQueueList::Queue should already be linked up."); for (int i = cur->first; i < cur->end; ++i) { if (cur->data[i] == threadID) { int remaining = --cur->end - i; if (remaining > 0) memmove(&cur->data[i], &cur->data[i + 1], remaining * sizeof(SceUID)); return; } } // Wasn't there. ERROR_LOG(HLE, "Unable to remove thread %d from queue %d - was not there", threadID, priority); }

And, no rush, I can wait.

-[Unknown]
Reply


Messages In This Thread
RE: Darkstalkers Chronicle The Chaos Tower - by [Unknown] - 01-06-2014, 02:53 PM

Forum Jump: