Thread: Convert waiting_threads list from Handle to pointers

This commit is contained in:
Yuri Kunde Schlesner 2014-12-22 12:14:48 -02:00
parent e19dc7e6f0
commit 5eb52c950d
2 changed files with 3 additions and 5 deletions

View File

@ -24,7 +24,7 @@ namespace Kernel {
ResultVal<bool> Thread::WaitSynchronization() { ResultVal<bool> Thread::WaitSynchronization() {
const bool wait = status != THREADSTATUS_DORMANT; const bool wait = status != THREADSTATUS_DORMANT;
if (wait) { if (wait) {
Handle thread = GetCurrentThread()->GetHandle(); Thread* thread = GetCurrentThread();
if (std::find(waiting_threads.begin(), waiting_threads.end(), thread) == waiting_threads.end()) { if (std::find(waiting_threads.begin(), waiting_threads.end(), thread) == waiting_threads.end()) {
waiting_threads.push_back(thread); waiting_threads.push_back(thread);
} }
@ -125,9 +125,7 @@ void Thread::Stop(const char* reason) {
ChangeReadyState(this, false); ChangeReadyState(this, false);
status = THREADSTATUS_DORMANT; status = THREADSTATUS_DORMANT;
for (Handle waiting_handle : waiting_threads) { for (Thread* waiting_thread : waiting_threads) {
Thread* waiting_thread = g_handle_table.Get<Thread>(waiting_handle);
if (CheckWaitType(waiting_thread, WAITTYPE_THREADEND, GetHandle())) if (CheckWaitType(waiting_thread, WAITTYPE_THREADEND, GetHandle()))
waiting_thread->ResumeFromWait(); waiting_thread->ResumeFromWait();
} }

View File

@ -97,7 +97,7 @@ public:
Handle wait_handle; Handle wait_handle;
VAddr wait_address; VAddr wait_address;
std::vector<Handle> waiting_threads; std::vector<Thread*> waiting_threads; // TODO(yuriks): Owned
std::string name; std::string name;