mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-06-03 12:27:21 +12:00
Semaphores v0.1
This commit is contained in:
parent
3c55d88fab
commit
7b8cac8d43
6 changed files with 44 additions and 11 deletions
|
@ -48,6 +48,7 @@ class Kernel {
|
|||
|
||||
public:
|
||||
Handle makeMutex(bool locked = false); // Needs to be public to be accessible to the APT/DSP services
|
||||
Handle makeSemaphore(u32 initialCount, u32 maximumCount); // Needs to be public to be accessible to the service manager port
|
||||
|
||||
private:
|
||||
void signalArbiter(u32 waitingAddress, s32 threadCount);
|
||||
|
|
|
@ -118,7 +118,7 @@ struct Thread {
|
|||
u32 waitingAddress;
|
||||
|
||||
// The nanoseconds until a thread wakes up from being asleep or from timing out while waiting on an arbiter
|
||||
s64 waitingNanoseconds;
|
||||
u64 waitingNanoseconds;
|
||||
// The tick this thread went to sleep on
|
||||
u64 sleepTick;
|
||||
// For WaitSynchronization: A vector of objects this thread is waiting for
|
||||
|
@ -157,6 +157,13 @@ struct Mutex {
|
|||
Mutex(bool lock = false) : locked(lock) {}
|
||||
};
|
||||
|
||||
struct Semaphore {
|
||||
u32 initialCount;
|
||||
u32 maximumCount;
|
||||
|
||||
Semaphore(u32 initialCount, u32 maximumCount) : initialCount(initialCount), maximumCount(maximumCount) {}
|
||||
};
|
||||
|
||||
// Generic kernel object class
|
||||
struct KernelObject {
|
||||
Handle handle = 0; // A u32 the OS will use to identify objects
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue