sleep_queue_t moved to SleepQueue.cpp, cleanup

Used ARMv7Thread instead of ARMv7Context in PSV HLE functions and
callbacks. However, interpreter still uses ARMv7Context.
Various PSV functions partially implemented:
sceKernelCreateEventFlag
sceKernelDeleteEventFlag
sceKernelOpenEventFlag
sceKernelCloseEventFlag
sceKernelWaitEventFlag
sceKernelWaitEventFlagCB
sceKernelPollEventFlag
sceKernelSetEventFlag
sceKernelClearEventFlag
sceKernelCancelEventFlag
sceKernelGetEventFlagInfo
sceKernelCreateSema
sceKernelDeleteSema
sceKernelCreateMutex
sceKernelDeleteMutex
sceKernelCreateCond
sceKernelDeleteCond
This commit is contained in:
Nekotekina 2015-08-08 00:37:32 +03:00
parent 94d1488259
commit c6bdedf3b0
54 changed files with 602 additions and 370 deletions

46
Utilities/SleepQueue.h Normal file
View file

@ -0,0 +1,46 @@
#pragma once
class CPUThread;
using sleep_queue_t = std::deque<std::shared_ptr<CPUThread>>;
static struct defer_sleep_t {} const defer_sleep{};
// automatic object handling a thread entry in the sleep queue
class sleep_queue_entry_t final
{
CPUThread& m_thread;
sleep_queue_t& m_queue;
void add_entry();
void remove_entry();
bool find() const;
public:
// add specified thread to the sleep queue
sleep_queue_entry_t(CPUThread& cpu, sleep_queue_t& queue);
// don't add specified thread to the sleep queue
sleep_queue_entry_t(CPUThread& cpu, sleep_queue_t& queue, const defer_sleep_t&);
// removes specified thread from the sleep queue if added
~sleep_queue_entry_t() noexcept(false);
// add thread to the sleep queue
inline void enter()
{
add_entry();
}
// remove thread from the sleep queue
inline void leave()
{
remove_entry();
}
// check whether the thread exists in the sleep queue
inline explicit operator bool() const
{
return find();
}
};