Removed DUSK_ prefix

This commit is contained in:
2025-08-23 10:13:49 -05:00
parent 1bf6fe6eaf
commit 1dfde00317
28 changed files with 148 additions and 101 deletions

View File

@@ -14,11 +14,11 @@ target_sources(${DUSK_TARGET_NAME}
if(DUSK_TARGET_SYSTEM STREQUAL "linux")
target_compile_definitions(${DUSK_TARGET_NAME}
PRIVATE
DUSK_THREAD_PTHREAD=1
THREAD_PTHREAD=1
)
elseif(DUSK_TARGET_SYSTEM STREQUAL "psp")
target_compile_definitions(${DUSK_TARGET_NAME}
PRIVATE
DUSK_THREAD_PTHREAD=1
THREAD_PTHREAD=1
)
endif()

View File

@@ -18,7 +18,7 @@ void threadInit(thread_t *thread, const threadcallback_t callback) {
thread->state = THREAD_STATE_STOPPED;
thread->callback = callback;
#if DUSK_THREAD_PTHREAD
#if THREAD_PTHREAD
thread->threadId = 0;
#endif
}
@@ -30,7 +30,7 @@ void threadStartRequest(thread_t *thread) {
thread->state = THREAD_STATE_STARTING;
threadMutexUnlock(&thread->stateMutex);
#if DUSK_THREAD_PTHREAD
#if THREAD_PTHREAD
assertTrue(thread->threadId == 0, "Thread id not 0.");
pthread_create(
@@ -93,7 +93,7 @@ bool_t threadShouldStop(thread_t *thread) {
return state;
}
#if DUSK_THREAD_PTHREAD
#if THREAD_PTHREAD
void * threadHandler(thread_t *thread) {
assertNotNull(thread, "Thread cannot be NULL.");

View File

@@ -8,7 +8,7 @@
#pragma once
#include "thread/threadmutex.h"
#if DUSK_THREAD_PTHREAD
#if THREAD_PTHREAD
#include <pthread.h>
#else
#error "At least one threading implementation must be defined."
@@ -40,7 +40,7 @@ typedef struct thread_s {
threadcallback_t callback;
void *data;
#if DUSK_THREAD_PTHREAD
#if THREAD_PTHREAD
pthread_t threadId;
#endif
} thread_t;
@@ -93,7 +93,7 @@ void threadStop(thread_t *thread);
*/
bool_t threadShouldStop(thread_t *thread);
#if DUSK_THREAD_PTHREAD
#if THREAD_PTHREAD
/**
* Handles the thread's lifecycle for pthreads.
* @param thread Pointer to the thread structure to handle.

View File

@@ -8,43 +8,43 @@
#include "threadmutex.h"
void threadMutexInit(threadmutex_t *lock) {
#if DUSK_THREAD_PTHREAD
#if THREAD_PTHREAD
pthread_mutex_init(&lock->mutex, NULL);
#endif
}
void threadMutexLock(threadmutex_t *lock) {
#if DUSK_THREAD_PTHREAD
#if THREAD_PTHREAD
pthread_mutex_lock(&lock->mutex);
#endif
}
bool_t threadMutexTryLock(threadmutex_t *lock) {
#if DUSK_THREAD_PTHREAD
#if THREAD_PTHREAD
return pthread_mutex_trylock(&lock->mutex) == 0;
#endif
}
void threadMutexUnlock(threadmutex_t *lock) {
#if DUSK_THREAD_PTHREAD
#if THREAD_PTHREAD
pthread_mutex_unlock(&lock->mutex);
#endif
}
void threadMutexWaitLock(threadmutex_t *lock) {
#if DUSK_THREAD_PTHREAD
#if THREAD_PTHREAD
pthread_cond_wait(&lock->cond, &lock->mutex);
#endif
}
void threadMutexSignal(threadmutex_t *lock) {
#if DUSK_THREAD_PTHREAD
#if THREAD_PTHREAD
pthread_cond_signal(&lock->cond);
#endif
}
void threadMutexDispose(threadmutex_t *lock) {
#if DUSK_THREAD_PTHREAD
#if THREAD_PTHREAD
pthread_mutex_destroy(&lock->mutex);
#endif
}

View File

@@ -8,14 +8,14 @@
#pragma once
#include "dusk.h"
#if DUSK_THREAD_PTHREAD
#if THREAD_PTHREAD
#include <pthread.h>
#else
#error "At least one threading implementation must be defined."
#endif
typedef struct threadlock_t {
#if DUSK_THREAD_PTHREAD
#if THREAD_PTHREAD
pthread_mutex_t mutex;
pthread_cond_t cond;
#endif