diff options
| author | Amlal El Mahrouss <amlal@nekernel.org> | 2026-03-18 13:11:57 +0100 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal@nekernel.org> | 2026-03-18 13:11:57 +0100 |
| commit | afdc4702385dfa66ba20b46b98d81bd224c2d84e (patch) | |
| tree | 64fe06d82c4bc4408f0456298e71883059123b23 /src | |
| parent | 30bfed60419707e94a0128f20199f98d008a1473 (diff) | |
[FEAT] PThread implementation improvements for v2.
Signed-off-by: Amlal El Mahrouss <amlal@nekernel.org>
Diffstat (limited to 'src')
| -rw-r--r-- | src/kernel/src/Json.cpp | 3 | ||||
| -rw-r--r-- | src/libMsg/src/Server.cpp | 6 | ||||
| -rw-r--r-- | src/libPThread/src/Thread.cpp | 6 | ||||
| -rw-r--r-- | src/libSoundSystem/SoundSystemKit/VirtualMixer.h | 8 |
4 files changed, 16 insertions, 7 deletions
diff --git a/src/kernel/src/Json.cpp b/src/kernel/src/Json.cpp index 06e428e9..ca8b10d3 100644 --- a/src/kernel/src/Json.cpp +++ b/src/kernel/src/Json.cpp @@ -5,4 +5,5 @@ #include <NeKit/Json.h> -namespace Kernel {}
\ No newline at end of file +namespace Kernel {} + diff --git a/src/libMsg/src/Server.cpp b/src/libMsg/src/Server.cpp index e4602047..a2f17e91 100644 --- a/src/libMsg/src/Server.cpp +++ b/src/libMsg/src/Server.cpp @@ -23,13 +23,15 @@ IMPORT_C UInt32 libmsg_eval_expr(struct LIBMSG_EXPR* head, VoidPtr arg, SizeT ar if (!head) return 0; - kSemaphore = SemCreate(1000, 1000, "libmsg_semaphore"); + static kSemWaitTime = 1000; + + kSemaphore = ::SemCreate(kSemWaitTime, kSemWaitTime, "libmsg_semaphore"); if (!kSemaphore) return 0; kFuncs[head->l_index](head, arg, arg_size); - SemClose(kSemaphore); + ::SemClose(kSemaphore); kSemaphore = nullptr; return 0; diff --git a/src/libPThread/src/Thread.cpp b/src/libPThread/src/Thread.cpp index b70cf7d6..c1799d9c 100644 --- a/src/libPThread/src/Thread.cpp +++ b/src/libPThread/src/Thread.cpp @@ -23,8 +23,10 @@ PTHREAD_SAFE SInt32 pthread_exit(SInt32 retval) { PTHREAD_SAFE SInt32 pthread_join(ThreadRef thread, VoidPtr* retval) { SInt32* ret = (SInt32*) retval; - *ret = ThrJoinThread(thread); + if (!ret) return -1; + + *ret = ThrJoinThread(thread); return 0; } @@ -32,6 +34,8 @@ PTHREAD_SAFE SInt32 pthread_create(_Output ThreadRef* thread, VoidPtr at VoidPtr (*start_routine)(VoidPtr), VoidPtr arg) { LIBSYS_UNUSED(attr); + if (!attr || !thread || !arg || !start_routine) return -1; + /// @note passing zero means you'd have to read the argv until you hit a nullptr. ThreadRef thrd = ThrCreateThread("pthread_thread", (ThrProcKind) start_routine, 0, arg, 0); diff --git a/src/libSoundSystem/SoundSystemKit/VirtualMixer.h b/src/libSoundSystem/SoundSystemKit/VirtualMixer.h index 69fa341a..4a46eb73 100644 --- a/src/libSoundSystem/SoundSystemKit/VirtualMixer.h +++ b/src/libSoundSystem/SoundSystemKit/VirtualMixer.h @@ -10,9 +10,11 @@ #include <libSystem/SystemKit/System.h> namespace SoundSystem { -struct VirtualMixer; -struct VirtualSource; -struct VirtualVolume; + + struct VirtualMixer; + struct VirtualSource; + struct VirtualVolume; + } // namespace SoundSystem #endif |
