summaryrefslogtreecommitdiffhomepage
path: root/Public/Developer/SystemLib/Headers/Thread.h
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal@el-mahrouss-logic.com>2024-03-29 17:01:55 +0100
committerAmlal El Mahrouss <amlal@el-mahrouss-logic.com>2024-03-29 17:06:28 +0100
commit7e5be1572c043484293ee0cdd840dd41f54e87ee (patch)
tree171427b27eb240d4006fda89e485ce6da28fd749 /Public/Developer/SystemLib/Headers/Thread.h
parentd7eb7affee3733dfeee6864045da4c2f5df2e919 (diff)
Kernel and SystemLib: See below.
What has been done: - Rename most System.Core to SystemLib. - Reworked it's API and the concept of ObjectRef to become the ApplicationRef object. - Remove unused ODF and XIFF file format from tree, ODF will be part of the text editing program. - Update Readme for SystemLib. - Add Support folder on NewFS partitions. What is next: - NewFS filesystem support. - Program loading. - Preemptive scheduler on non-SMP systems using timers. Signed-off-by: Amlal El Mahrouss <amlal@el-mahrouss-logic.com>
Diffstat (limited to 'Public/Developer/SystemLib/Headers/Thread.h')
-rw-r--r--Public/Developer/SystemLib/Headers/Thread.h43
1 files changed, 43 insertions, 0 deletions
diff --git a/Public/Developer/SystemLib/Headers/Thread.h b/Public/Developer/SystemLib/Headers/Thread.h
new file mode 100644
index 00000000..4a54d841
--- /dev/null
+++ b/Public/Developer/SystemLib/Headers/Thread.h
@@ -0,0 +1,43 @@
+/* -------------------------------------------
+
+ Copyright Mahrouss Logic
+
+------------------------------------------- */
+
+//
+// Created by Amlal on 3/18/24
+//
+
+#ifndef __THREAD__
+#define __THREAD__
+
+#include <Headers/Defines.h>
+
+#define kThreadErrorExit -33
+
+/// @brief Thread Information Block, which holds information about the running
+/// thread.
+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 TmCreateThread(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 TmDisposeThread(ThreadRef ref);
+
+/// @brief Waits for the thread to complete.
+/// @param ref the thread reference.
+/// @return nothing.
+CA_EXTERN_C VoidType TmWaitForCompletion(ThreadRef ref);
+
+#endif // __THREAD__