summaryrefslogtreecommitdiff
path: root/include/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'include/kernel')
-rw-r--r--include/kernel/kernel/threadmgr.h83
1 files changed, 83 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 */