diff options
-rw-r--r-- | include/kernel/kernel/threadmgr.h | 83 | ||||
-rw-r--r-- | nids/360/SceKernelThreadMgr.yml | 3 |
2 files changed, 86 insertions, 0 deletions
diff --git a/include/kernel/kernel/threadmgr.h b/include/kernel/kernel/threadmgr.h index c702725..8990a7b 100644 --- a/include/kernel/kernel/threadmgr.h +++ b/include/kernel/kernel/threadmgr.h @@ -580,6 +580,89 @@ typedef struct SceKernelLwCondOptParam { SceSize size; } SceKernelLwCondOptParam; +/** Additional options used when creating condition variables. */ +typedef struct SceKernelCondOptParam { + /** Size of the ::SceKernelCondOptParam structure. */ + SceSize size; +} SceKernelCondOptParam; + +/** Current state of a condition variable. + * @see sceKernelGetCondInfo. + */ +typedef struct SceKernelCondInfo { + /** Size of the ::SceKernelCondInfo structure. */ + SceSize size; + /** The UID of the condition variable. */ + SceUID condId; + /** NUL-terminated name of the condition variable. */ + char name[32]; + /** Attributes. */ + SceUInt attr; + /** Mutex associated with the condition variable. */ + SceUID mutexId; + /** The number of threads waiting on the condition variable. */ + int numWaitThreads; +} SceKernelCondInfo; + +/** + * Creates a new condition variable + * + * @par Example: + * @code + * SceUID condId; + * condId = sceKernelCreateCond("MyCond", 0, mutexId, NULL); + * @endcode + * + * @param name - Specifies the name of the condition variable + * @param attr - Condition variable attribute flags (normally set to 0) + * @param mutexId - Mutex to be related to the condition variable + * @param option - Condition variable options (normally set to 0) + * @return A condition variable id + */ +SceUID sceKernelCreateCond(const char *name, SceUInt attr, SceUID mutexId, const SceKernelCondOptParam *option); + +/** + * Destroy a condition variable + * + * @param condition variableid - The condition variable id returned from ::sceKernelCreateCond + * @return Returns the value 0 if it's successful, otherwise -1 + */ +int sceKernelDeleteCond(SceUID condId); + +/** + * Waits for a signal of a condition variable + * + * @param condId - The condition variable id returned from ::sceKernelCreateCond + * @param timeout - Timeout in microseconds (assumed) + * @return < 0 On error. + */ +int sceKernelWaitCond(SceUID condId, unsigned int *timeout); + +/** + * Signals a condition variable + * + * @param condId - The condition variable id returned from ::sceKernelCreateCond + * @return < 0 On error. + */ +int sceKernelSignalCond(SceUID condId); + +/** + * Signals a condition variable to all threads waiting for it + * + * @param condId - The condition variable id returned from ::sceKernelCreateCond + * @return < 0 On error. + */ +int sceKernelSignalCondAll(SceUID condId); + +/** + * Signals a condition variable to a specific thread waiting for it + * + * @param condId - The condition variable id returned from ::sceKernelCreateCond + * @param threadId - The thread id returned from ::sceKernelCreateThread + * @return < 0 On error. + */ +int sceKernelSignalCondTo(SceUID condId, SceUID threadId); + /* Callbacks. */ /** Callback function prototype */ diff --git a/nids/360/SceKernelThreadMgr.yml b/nids/360/SceKernelThreadMgr.yml index 15e4988..890dc77 100644 --- a/nids/360/SceKernelThreadMgr.yml +++ b/nids/360/SceKernelThreadMgr.yml @@ -113,6 +113,7 @@ modules: sceKernelClearEvent: 0x9C335818 sceKernelClearEventFlag: 0x4F1DA3BE sceKernelCreateCallback: 0x1C41614C + sceKernelCreateCond: 0xDB6CD34A sceKernelCreateEventFlag: 0x4336BAA4 sceKernelCreateMutex: 0xFBAA026E sceKernelCreateSema: 0x30E93C31 @@ -121,6 +122,7 @@ modules: sceKernelDelayThread: 0x4B675D05 sceKernelDelayThreadCB: 0x9C0180E1 sceKernelDeleteCallback: 0x3A7E17F6 + sceKernelDeleteCond: 0xAEE0D27C sceKernelDeleteEventFlag: 0x71ECB352 sceKernelDeleteFastMutex: 0x11FE84A1 sceKernelDeleteMutex: 0x0A912340 @@ -171,6 +173,7 @@ modules: sceKernelUnregisterCallbackFromEvent: 0x2E48D81C sceKernelUnregisterCallbackFromEventAll: 0x8DADBD16 sceKernelUnregisterThreadEventHandler: 0x2C8ED6F0 + sceKernelWaitCond: 0xCC7E027D sceKernelWaitEvent: 0xC529EA32 sceKernelWaitEventCB: 0x360C655C sceKernelWaitEventFlag: 0x0C1D3F20 |