diff options
| author | Amlal El Mahrouss <amlal@el-mahrouss-logic.com> | 2024-03-27 17:38:23 +0100 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal@el-mahrouss-logic.com> | 2024-03-27 17:38:23 +0100 |
| commit | 1ce16b83dba0326b13dfa3399c1497ac6b1af14d (patch) | |
| tree | 8a5e4063b5d4cf6ce4f42dd500073994e9ef8954 /Public/Developer/System.Core/Headers/Thread.h | |
| parent | 6a18e607ffc4e83f2bd953c9de5c14f18e077df8 (diff) | |
Kernel && Developer:
Developer:
- Rework System API to use C instead of C++
- Add new calls in Thread.h
- Documented code.
Kernel:
- Rework handover stage, separated the Processor specific code from
the cross platform code.
Signed-off-by: Amlal El Mahrouss <amlal@el-mahrouss-logic.com>
Diffstat (limited to 'Public/Developer/System.Core/Headers/Thread.h')
| -rw-r--r-- | Public/Developer/System.Core/Headers/Thread.h | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/Public/Developer/System.Core/Headers/Thread.h b/Public/Developer/System.Core/Headers/Thread.h new file mode 100644 index 00000000..7d2bfe3c --- /dev/null +++ b/Public/Developer/System.Core/Headers/Thread.h @@ -0,0 +1,43 @@ +/* ------------------------------------------- + + Copyright Mahrouss Logic + +------------------------------------------- */ + +// +// Created by Amlal on 3/18/24 +// + +#ifndef __THREAD__ +#define __THREAD__ + +#include <System.Core/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__ |
