diff options
| author | Amlal El Mahrouss <amlal.elmahrouss@icloud.com> | 2024-05-09 00:42:44 +0200 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal.elmahrouss@icloud.com> | 2024-05-09 00:42:44 +0200 |
| commit | af8a516fc22865abd80d6e26f1541fa3d6bebfdc (patch) | |
| tree | 96d42a10945fc03df022389aef54708383c1d616 /SDK/Library/CoreSystem/Headers/Thread.h | |
| parent | a874e9cc98df994178d55996943fe81799c61d2f (diff) | |
MHR-23: :boom:, refactors.
- Move NewBoot to /Boot, thus making Kernel directory only containing the kernel.
Signed-off-by: Amlal El Mahrouss <amlal.elmahrouss@icloud.com>
Diffstat (limited to 'SDK/Library/CoreSystem/Headers/Thread.h')
| -rw-r--r-- | SDK/Library/CoreSystem/Headers/Thread.h | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/SDK/Library/CoreSystem/Headers/Thread.h b/SDK/Library/CoreSystem/Headers/Thread.h new file mode 100644 index 00000000..f0360b63 --- /dev/null +++ b/SDK/Library/CoreSystem/Headers/Thread.h @@ -0,0 +1,47 @@ +/* ------------------------------------------- + + Copyright SoftwareLabs + +------------------------------------------- */ + +// +// 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__ |
