summaryrefslogtreecommitdiff
path: root/include/user/kernel/threadmgr.h
diff options
context:
space:
mode:
authorSergi Granell2017-01-14 10:47:15 +0100
committerSergi Granell2017-01-14 10:47:15 +0100
commite1a4159edfe4f3ad77ac7b85d15822c76efbc5fc (patch)
tree5454a8975f3b79bbe5f45ae975d1e0fff86c6e1e /include/user/kernel/threadmgr.h
parentAdded usb nids and headers (#120) (diff)
downloadvds-libraries-e1a4159edfe4f3ad77ac7b85d15822c76efbc5fc.tar.gz
Add Condition variables prototypes
Diffstat (limited to 'include/user/kernel/threadmgr.h')
-rw-r--r--include/user/kernel/threadmgr.h109
1 files changed, 109 insertions, 0 deletions
diff --git a/include/user/kernel/threadmgr.h b/include/user/kernel/threadmgr.h
index 9225fb1..ef9c58c 100644
--- a/include/user/kernel/threadmgr.h
+++ b/include/user/kernel/threadmgr.h
@@ -698,6 +698,115 @@ int sceKernelDeleteEventFlag(int evid);
*/
int sceKernelGetEventFlagInfo(SceUID event, SceKernelEventFlagInfo *info);
+/* Condition variables */
+
+/** 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
+ * int condition variableid;
+ * condition variableid = 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 its succesful otherwise -1
+ */
+int sceKernelDeleteCond(SceUID condId);
+
+/**
+ * Open a condition variable
+ *
+ * @param name - The name of the condition variable to open
+ * @return Returns the value 0 if its succesful otherwise -1
+ */
+int sceKernelOpenCond(const char *name);
+
+/**
+ * Close a condition variable
+ *
+ * @param condition variableid - The condition variable id returned from sceKernelCreateCond
+ * @return Returns the value 0 if its succesful otherwise -1
+ */
+int sceKernelCloseCond(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);
+
+/**
+ * Waits for a signal of a condition variable (with callbacks)
+ *
+ * @param condId - The condition variable id returned from sceKernelCreateCond
+ * @param timeout - Timeout in microseconds (assumed)
+ * @return < 0 On error.
+ */
+int sceKernelWaitCondCB(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. */