summaryrefslogtreecommitdiffhomepage
path: root/SDK/Developer/CoreSystem/Headers/Thread.h
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2024-05-08 12:32:41 +0200
committerAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2024-05-08 12:32:41 +0200
commit09dd11ddf800898c00ecb04a65fb5cd10fb481fa (patch)
treeeda0b4e23d6a71da7de3a78f0bb76ec3201dd2f9 /SDK/Developer/CoreSystem/Headers/Thread.h
parentca83108fd138cc0398f900e6a6c0a53ad51aee31 (diff)
MHR-23: :boom: changes, reworked project tree.
Signed-off-by: Amlal El Mahrouss <amlal.elmahrouss@icloud.com>
Diffstat (limited to 'SDK/Developer/CoreSystem/Headers/Thread.h')
-rw-r--r--SDK/Developer/CoreSystem/Headers/Thread.h47
1 files changed, 47 insertions, 0 deletions
diff --git a/SDK/Developer/CoreSystem/Headers/Thread.h b/SDK/Developer/CoreSystem/Headers/Thread.h
new file mode 100644
index 00000000..9562003e
--- /dev/null
+++ b/SDK/Developer/CoreSystem/Headers/Thread.h
@@ -0,0 +1,47 @@
+/* -------------------------------------------
+
+ Copyright Mahrouss Logic
+
+------------------------------------------- */
+
+//
+// Created by Amlal on 3/18/24
+//
+
+#ifndef __THREAD__
+#define __THREAD__
+
+#include <Headers/Defines.h>
+
+#define kThreadErrorExit (-33)
+
+/// @brief Thread reference.
+typedef QWordType ThreadRef;
+
+/// @brief Main application thread.
+CA_EXTERN_C ThreadRef kMainThread;
+
+typedef VoidType (*ThreadEntrypointKind)(VoidType);
+
+/// @brief Creates a new thread, and runs the code.
+/// @param threadName the thread's name.
+/// @param threadStart where to start.
+/// @return
+CA_EXTERN_C ThreadRef CTCreate(const CharacterTypeUTF8* threadName, ThreadEntrypointKind threadStart);
+
+/// @brief Dispoes the thread, and exits with code kThreadErrorExit
+/// @param ref the thread reference.
+/// @return nothing.
+CA_EXTERN_C VoidType CTRelease(ThreadRef ref);
+
+/// @brief Waits for the thread to complete.
+/// @param ref the thread reference.
+/// @return nothing.
+CA_EXTERN_C VoidType CTJoin(ThreadRef ref);
+
+/// @brief Yields the current thread.
+/// @param ref the thead reference.
+/// @return
+CA_EXTERN_C VoidType CTYield(ThreadRef ref);
+
+#endif // __THREAD__