Line 98: |
Line 98: |
| Lower priority values give the thread higher priority. For userland apps, priorities between 0x18 and 0x3F are allowed. The priority of the app's main thread seems to be 0x30. | | Lower priority values give the thread higher priority. For userland apps, priorities between 0x18 and 0x3F are allowed. The priority of the app's main thread seems to be 0x30. |
| | | |
− | The thread scheduler is cooperative, therefore if a thread takes up all the CPU time (for example if it enters an endless loop), all the other threads that run on the same CPU core won't get a chance to run. The main way of yielding another thread is using an address arbiter. | + | The [[Glossary#appcore|appcore]] thread scheduler primarily uses a cooperative design, therefore if a thread takes up all the CPU time (for example if it enters an endless loop), all the other threads that run on the same CPU core won't get a chance to run. The main way of yielding another thread is using an address arbiter. In certain cases, execution of the current task may be preempted regardless, for instance when a thread was waiting on svcSendSyncRequest to return. |
| | | |
| 0xFFFF8000 is a handle alias for the currently active thread. | | 0xFFFF8000 is a handle alias for the currently active thread. |
Line 265: |
Line 265: |
| * KClientPort: Wakes if max sessions not reached (free session available) | | * KClientPort: Wakes if max sessions not reached (free session available) |
| * KClientSession: Always false? | | * KClientSession: Always false? |
− | * KDebug: ??? | + | * KDebug: Waits until a debug event is signaled (the user should then use svcGetProcessDebugEvent to get the debug event info) |
| * KDmaObject: ??? | | * KDmaObject: ??? |
| * KEvent: Waits until the event is signaled | | * KEvent: Waits until the event is signaled |
− | * KInterruptEvent: ???
| |
| * KMutex: Acquires a lock on the mutex (blocks until this succeeds) | | * KMutex: Acquires a lock on the mutex (blocks until this succeeds) |
− | * KProcess: Waits until the process exits | + | * KProcess: Waits until the process exits/is terminated |
| * KSemaphore: This consumes a value from the semaphore count, if possible, otherwise continues to wait | | * KSemaphore: This consumes a value from the semaphore count, if possible, otherwise continues to wait |
| * KServerPort: Waits for a new client connection, upon which svcAcceptSession is ready to be called | | * KServerPort: Waits for a new client connection, upon which svcAcceptSession is ready to be called |
Line 288: |
Line 287: |
| | | |
| === ReleaseMutex === | | === ReleaseMutex === |
− |
| |
− | == Critical Section (light-weight mutex) ==
| |
− |
| |
− | Similar to a mutex, but faster and no priority inheritance. Therefore problems such as priority inversion may occur.
| |
− |
| |
− | === CriticalSection::Initialize ===
| |
− |
| |
− | Creates an object
| |
− |
| |
− | === CriticalSection::Enter ===
| |
− |
| |
− | Locks out threads from accessing a critical section.
| |
− |
| |
− | === CriticalSection::Leave ===
| |
− |
| |
− | Unlocks and allows for access to a critical section.
| |
| | | |
| == Semaphore == | | == Semaphore == |
− |
| |
− | == Light Semaphore ==
| |
| | | |
| == Event == | | == Event == |
− |
| |
− | == Light Event ==
| |
| | | |
| == Address Arbiters == | | == Address Arbiters == |