mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-06-04 04:47:22 +12:00
[Kernel Add WakeupOneThread
This commit is contained in:
parent
856aaf4440
commit
dac77cdc1d
3 changed files with 63 additions and 3 deletions
|
@ -77,6 +77,12 @@ private:
|
|||
bool shouldWaitOnObject(KernelObject* object);
|
||||
void releaseMutex(Mutex* moo);
|
||||
|
||||
// Wake up the thread with the highest priority out of all threads in the waitlist
|
||||
// Returns the index of the woken up thread
|
||||
// Do not call this function with an empty waitlist!!!
|
||||
int wakeupOneThread(u64 waitlist, Handle handle);
|
||||
void wakeupAllThreads(u64 waitlist, Handle handle);
|
||||
|
||||
std::optional<Handle> getPortHandle(const char* name);
|
||||
void deleteObjectData(KernelObject& object);
|
||||
|
||||
|
|
|
@ -174,10 +174,11 @@ static const char* kernelObjectTypeToString(KernelObjectType t) {
|
|||
struct Mutex {
|
||||
u64 waitlist; // Refer to the getWaitlist function below for documentation
|
||||
Handle ownerThread = 0; // Index of the thread that holds the mutex if it's locked
|
||||
Handle handle; // Handle of the mutex itself
|
||||
u32 lockCount; // Number of times this mutex has been locked by its daddy. 0 = not locked
|
||||
bool locked;
|
||||
|
||||
Mutex(bool lock = false) : locked(lock), waitlist(0), lockCount(lock ? 1 : 0) {}
|
||||
Mutex(bool lock, Handle handle) : locked(lock), waitlist(0), lockCount(lock ? 1 : 0), handle(handle) {}
|
||||
};
|
||||
|
||||
struct Semaphore {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue