Added type gThread to replace V2.x gfxThreadHandle

This commit is contained in:
inmarket 2018-07-08 15:40:27 +10:00
parent 1fc4180d41
commit 330f891081
34 changed files with 78 additions and 76 deletions

View File

@ -18,6 +18,7 @@ CHANGE: Added types gI8, gU8 .. gI32, gU32 to replace V2.x int8_t etc
CHANGE: Added type gBool to replace V2.x bool_t, and values gTrue/gFalse to replace TRUE/FALSE
CHANGE: Added type gDelay to replace V2.x delaytime_t and values gDelayNone/gDelayForever to replace TIME_IMMEDIATE/TIME_INFINITE
CHANGE: Added type gTicks to replace V2.x systemticks_t
CHANGE: Added type gThread to replace V2.x gfxThreadHandle
CHANGE: Added type gThreadreturn to replace V2.x threadreturn_t
CHANGE: Added type gThreadpriority to replace V2.x threadpriority_t and values gThreadpriorityLow/Normal/High to replace LOW_/NORMAL_/HIGH_PRIORITY
CHANGE: Added type gPoint to replace V2.x point and point_t

View File

@ -464,7 +464,7 @@ static DECLARE_THREAD_FUNCTION(notepadThread, param) {
void nSetColorScheme(NColorScheme sch) { nCurColorScheme = sch; }
NColorScheme nGetColorScheme(void) { return nCurColorScheme; }
gfxThreadHandle nLaunchNotepadApp(void) {
gThread nLaunchNotepadApp(void) {
return gfxThreadCreate(waNotepadThread,
sizeof(waNotepadThread),

View File

@ -45,6 +45,6 @@ void nSetColorScheme(NColorScheme sch);
NColorScheme nGetColorScheme(void);
gfxThreadHandle nLaunchNotepadApp(void);
gThread nLaunchNotepadApp(void);
#endif /* NOTEPADAPP_H_ */

View File

@ -48,7 +48,7 @@ static DECLARE_THREAD_STACK(waDrawThread, NCORE_THD_STACK_SIZE);
static uint8_t nPenWidth = 1;
static uint8_t nMode = NCORE_MODE_DRAW;
static gfxThreadHandle nThd;
static gThread nThd;
static GHandle ncoreDrawingArea = NULL;
static GHandle nStatusConsole = NULL;

View File

@ -35,7 +35,7 @@
static volatile gBool run;
static GHandle gh;
static gfxThreadHandle thread;
static gThread thread;
/**
* NOTE:

View File

@ -32,7 +32,7 @@
static volatile gBool run;
static GHandle gh;
static gfxThreadHandle thread;
static gThread thread;
static void mandelbrot(float x1, float y1, float x2, float y2) {
unsigned int i,j, width, height;

View File

@ -41,7 +41,7 @@
#include "gfx.h"
GTimer gt;
gfxThreadHandle thd;
gThread thd;
#if defined(WIN32)
#include <windows.h>

View File

@ -302,7 +302,7 @@ LLDSPEC gBool gdisp_lld_init(GDisplay *g) {
xPriv *priv;
if (!initdone) {
gfxThreadHandle hth;
gThread hth;
initdone = gTrue;
#if GFX_USE_OS_LINUX || GFX_USE_OS_OSX

View File

@ -165,7 +165,7 @@ typedef struct netPriv {
#endif
} netPriv;
static gfxThreadHandle hThread;
static gThread hThread;
#if GDISP_GFXNET_UNSAFE_SOCKETS
static gfxMutex uGFXnetMutex;

View File

@ -123,7 +123,7 @@
* @brief A thread handle
* @note Your operating system will have a proper definition for this.
*/
typedef void * gfxThreadHandle;
typedef void * gThread;
/*===========================================================================*/
/* Function declarations. */
@ -420,7 +420,7 @@
*
* @api
*/
gfxThreadHandle gfxThreadCreate(void *stackarea, size_t stacksz, gThreadpriority prio, DECLARE_THREAD_FUNCTION((*fn),p), void *param);
gThread gfxThreadCreate(void *stackarea, size_t stacksz, gThreadpriority prio, DECLARE_THREAD_FUNCTION((*fn),p), void *param);
/**
* @brief Wait for a thread to finish.
@ -432,7 +432,7 @@
* once the thread has ended.
* @api
*/
gThreadreturn gfxThreadWait(gfxThreadHandle thread);
gThreadreturn gfxThreadWait(gThread thread);
/**
* @brief Get the current thread handle.
@ -440,7 +440,7 @@
*
* @api
*/
gfxThreadHandle gfxThreadMe(void);
gThread gfxThreadMe(void);
/**
* @brief Close the thread handle.
@ -451,7 +451,7 @@
*
* @api
*/
void gfxThreadClose(gfxThreadHandle thread);
void gfxThreadClose(gThread thread);
/**
* All the above was just for the doxygen documentation. All the implementation of the above
@ -501,6 +501,7 @@
#define TIME_INFINITE gDelayForever
#endif
typedef gTicks systemticks_t;
typedef gThread gfxThreadHandle;
typedef gThreadreturn threadreturn_t;
typedef gThreadpriority threadpriority_t;
#define LOW_PRIORITY gThreadpriorityLow

View File

@ -175,7 +175,7 @@ void gfxSemSignalI(gfxSem *psem)
#endif
}
gfxThreadHandle gfxThreadCreate(void *stackarea, size_t stacksz, gThreadpriority prio, DECLARE_THREAD_FUNCTION((*fn),p), void *param)
gThread gfxThreadCreate(void *stackarea, size_t stacksz, gThreadpriority prio, DECLARE_THREAD_FUNCTION((*fn),p), void *param)
{
if (!stackarea) {
if (!stacksz) stacksz = 256;

View File

@ -54,7 +54,7 @@ typedef tprio_t gThreadpriority;
} gfxSem;
typedef Mutex gfxMutex;
typedef Thread* gfxThreadHandle;
typedef Thread* gThread;
#else
#undef DECLARE_THREAD_STACK
#define DECLARE_THREAD_STACK(a, b) THD_WORKING_AREA(a, b)
@ -65,7 +65,7 @@ typedef tprio_t gThreadpriority;
} gfxSem;
typedef mutex_t gfxMutex;
typedef thread_t* gfxThreadHandle;
typedef thread_t* gThread;
#endif
@ -110,7 +110,7 @@ gBool gfxSemWait(gfxSem *psem, gDelay ms);
gBool gfxSemWaitI(gfxSem *psem);
void gfxSemSignal(gfxSem *psem);
void gfxSemSignalI(gfxSem *psem);
gfxThreadHandle gfxThreadCreate(void *stackarea, size_t stacksz, gThreadpriority prio, DECLARE_THREAD_FUNCTION((*fn),p), void *param);
gThread gfxThreadCreate(void *stackarea, size_t stacksz, gThreadpriority prio, DECLARE_THREAD_FUNCTION((*fn),p), void *param);
#define gfxThreadWait(thread) chThdWait(thread)
#define gfxThreadMe() chThdSelf()
#define gfxThreadClose(thread) (void)thread

View File

@ -88,7 +88,7 @@ void gfxSemSignalI(gfxSem* psem)
}
}
gfxThreadHandle gfxThreadCreate(void* stackarea, size_t stacksz, gThreadpriority prio, DECLARE_THREAD_FUNCTION((*fn),p), void* param)
gThread gfxThreadCreate(void* stackarea, size_t stacksz, gThreadpriority prio, DECLARE_THREAD_FUNCTION((*fn),p), void* param)
{
osThreadDef_t def;
@ -102,7 +102,7 @@ gfxThreadHandle gfxThreadCreate(void* stackarea, size_t stacksz, gThreadpriority
return osThreadCreate(&def, param);
}
gThreadreturn gfxThreadWait(gfxThreadHandle thread) {
gThreadreturn gfxThreadWait(gThread thread) {
while(osThreadGetPriority(thread) == osPriorityError)
gfxYield();
}

View File

@ -49,7 +49,7 @@ typedef struct gfxMutex {
osMutexId id;
} gfxMutex;
typedef osThreadId gfxThreadHandle;
typedef osThreadId gThread;
#define DECLARE_THREAD_STACK(name, sz) uint8_t name[1]; // Some compilers don't allow zero sized arrays. Let's waste one byte
#define DECLARE_THREAD_FUNCTION(fnName, param) gThreadreturn fnName(void* param)
@ -79,7 +79,7 @@ gBool gfxSemWaitI(gfxSem* psem);
void gfxSemSignal(gfxSem* psem);
void gfxSemSignalI(gfxSem* psem);
gfxThreadHandle gfxThreadCreate(void* stackarea, size_t stacksz, gThreadpriority prio, DECLARE_THREAD_FUNCTION((*fn),p), void* param);
gThread gfxThreadCreate(void* stackarea, size_t stacksz, gThreadpriority prio, DECLARE_THREAD_FUNCTION((*fn),p), void* param);
#define gfxYield() osThreadYield()
#define gfxThreadMe() osThreadGetId()
#define gfxThreadClose(thread) {}

View File

@ -76,7 +76,7 @@ gBool gfxSemWait(gfxSem* psem, gDelay ms)
return gFalse;
}
gfxThreadHandle gfxThreadCreate(void* stackarea, size_t stacksz, gThreadpriority prio, DECLARE_THREAD_FUNCTION((*fn),p), void* param)
gThread gfxThreadCreate(void* stackarea, size_t stacksz, gThreadpriority prio, DECLARE_THREAD_FUNCTION((*fn),p), void* param)
{
osThreadAttr_t def;
@ -93,7 +93,7 @@ gfxThreadHandle gfxThreadCreate(void* stackarea, size_t stacksz, gThreadpriority
return osThreadNew((osThreadFunc_t)fn, param, &def);
}
gThreadreturn gfxThreadWait(gfxThreadHandle thread) {
gThreadreturn gfxThreadWait(gThread thread) {
while(1) {
switch(osThreadGetState(thread)) {
case osThreadReady:

View File

@ -42,7 +42,7 @@ typedef osSemaphoreId_t gfxSem;
typedef osMutexId_t gfxMutex;
typedef osThreadId_t gfxThreadHandle;
typedef osThreadId_t gThread;
#define DECLARE_THREAD_STACK(name, sz) uint8_t name[1]; // Some compilers don't allow zero sized arrays. Let's waste one byte
#define DECLARE_THREAD_FUNCTION(fnName, param) gThreadreturn fnName(void* param)
@ -72,7 +72,7 @@ gBool gfxSemWait(gfxSem* psem, gDelay ms);
#define gfxSemSignal(psem) osSemaphoreRelease(*(psem))
#define gfxSemSignalI(psem) osSemaphoreRelease(*(psem))
gfxThreadHandle gfxThreadCreate(void* stackarea, size_t stacksz, gThreadpriority prio, DECLARE_THREAD_FUNCTION((*fn),p), void* param);
gThread gfxThreadCreate(void* stackarea, size_t stacksz, gThreadpriority prio, DECLARE_THREAD_FUNCTION((*fn),p), void* param);
#define gfxYield() osThreadYield()
#define gfxThreadMe() osThreadGetId()
#define gfxThreadClose(thread) {}

View File

@ -96,9 +96,9 @@ void gfxSemSignalI(gfxSem *psem)
cyg_semaphore_post(&psem->sem);
}
gfxThreadHandle gfxThreadCreate(void *stackarea, size_t stacksz, gThreadpriority prio, DECLARE_THREAD_FUNCTION((*fn),p), void *param)
gThread gfxThreadCreate(void *stackarea, size_t stacksz, gThreadpriority prio, DECLARE_THREAD_FUNCTION((*fn),p), void *param)
{
gfxThreadHandle th;
gThread th;
if (!stackarea) {
if (!stacksz) stacksz = CYGNUM_HAL_STACK_SIZE_TYPICAL;

View File

@ -26,7 +26,7 @@ typedef cyg_tick_count_t gTicks;
typedef cyg_count32 gSemcount;
typedef void gThreadreturn;
typedef cyg_addrword_t gThreadpriority;
typedef cyg_handle_t gfxThreadHandle;
typedef cyg_handle_t gThread;
#define MAX_SEMAPHORE_COUNT 0x7FFFFFFF
#define gThreadpriorityLow (CYGNUM_KERNEL_SCHED_PRIORITIES-2)
@ -77,7 +77,7 @@ gBool gfxSemWaitI(gfxSem *psem);
void gfxSemSignal(gfxSem *psem);
void gfxSemSignalI(gfxSem *psem);
gfxThreadHandle gfxThreadCreate(void *stackarea, size_t stacksz, gThreadpriority prio, DECLARE_THREAD_FUNCTION((*fn),p), void *param);
gThread gfxThreadCreate(void *stackarea, size_t stacksz, gThreadpriority prio, DECLARE_THREAD_FUNCTION((*fn),p), void *param);
#define gfxThreadWait(thread) NOTIMPLEMENTED_YET
#define gfxThreadMe() cyg_thread_self()
#define gfxThreadClose(thread) (void)thread

View File

@ -146,9 +146,9 @@ void gfxSemSignalI(gfxSem* psem)
xSemaphoreGiveFromISR(*psem,&xHigherPriorityTaskWoken);
}
gfxThreadHandle gfxThreadCreate(void *stackarea, size_t stacksz, gThreadpriority prio, DECLARE_THREAD_FUNCTION((*fn),p), void *param)
gThread gfxThreadCreate(void *stackarea, size_t stacksz, gThreadpriority prio, DECLARE_THREAD_FUNCTION((*fn),p), void *param)
{
gfxThreadHandle task;
gThread task;
(void) stackarea;
// uGFX expresses stack size in bytes - FreeRTOS in "Stack Words"
@ -165,7 +165,7 @@ gfxThreadHandle gfxThreadCreate(void *stackarea, size_t stacksz, gThreadpriority
}
#if INCLUDE_eTaskGetState == 1
gThreadreturn gfxThreadWait(gfxThreadHandle thread) {
gThreadreturn gfxThreadWait(gThread thread) {
while (eTaskGetState(thread) != eDeleted)
gfxYield();
}

View File

@ -44,7 +44,7 @@ typedef portBASE_TYPE gThreadpriority;
typedef xSemaphoreHandle gfxSem;
typedef xSemaphoreHandle gfxMutex;
typedef xTaskHandle gfxThreadHandle;
typedef xTaskHandle gThread;
/*===========================================================================*/
/* Function declarations. */
@ -75,11 +75,11 @@ gBool gfxSemWait(gfxSem* psem, gDelay ms);
gBool gfxSemWaitI(gfxSem* psem);
void gfxSemSignal(gfxSem* psem);
void gfxSemSignalI(gfxSem* psem);
gfxThreadHandle gfxThreadCreate(void *stackarea, size_t stacksz, gThreadpriority prio, DECLARE_THREAD_FUNCTION((*fn),p), void *param);
gThread gfxThreadCreate(void *stackarea, size_t stacksz, gThreadpriority prio, DECLARE_THREAD_FUNCTION((*fn),p), void *param);
#define gfxThreadMe() xTaskGetCurrentTaskHandle()
#if INCLUDE_eTaskGetState == 1
gThreadreturn gfxThreadWait(gfxThreadHandle thread);
gThreadreturn gfxThreadWait(gThread thread);
#endif
#define gfxThreadClose(thread)

View File

@ -109,8 +109,8 @@ gTicks gfxSystemTicks(void) {
return ts.tv_sec * 1000 + ts.tv_nsec / 1000000;
}
gfxThreadHandle gfxThreadCreate(void *stackarea, size_t stacksz, gThreadpriority prio, DECLARE_THREAD_FUNCTION((*fn),p), void *param) {
gfxThreadHandle th;
gThread gfxThreadCreate(void *stackarea, size_t stacksz, gThreadpriority prio, DECLARE_THREAD_FUNCTION((*fn),p), void *param) {
gThread th;
(void) stackarea;
(void) stacksz;
(void) prio;
@ -128,7 +128,7 @@ gfxThreadHandle gfxThreadCreate(void *stackarea, size_t stacksz, gThreadpriority
return th;
}
gThreadreturn gfxThreadWait(gfxThreadHandle thread) {
gThreadreturn gfxThreadWait(gThread thread) {
gThreadreturn retval;
if (pthread_join(thread, &retval))

View File

@ -26,7 +26,7 @@
typedef unsigned long gTicks;
typedef void * gThreadreturn;
typedef unsigned long gDelay;
typedef pthread_t gfxThreadHandle;
typedef pthread_t gThread;
typedef int gThreadpriority;
typedef uint32_t gSemcount;
typedef pthread_mutex_t gfxMutex;
@ -85,8 +85,8 @@ void gfxSemInit(gfxSem *psem, gSemcount val, gSemcount limit);
void gfxSemDestroy(gfxSem *psem);
gBool gfxSemWait(gfxSem *psem, gDelay ms);
void gfxSemSignal(gfxSem *psem);
gfxThreadHandle gfxThreadCreate(void *stackarea, size_t stacksz, gThreadpriority prio, DECLARE_THREAD_FUNCTION((*fn),p), void *param);
gThreadreturn gfxThreadWait(gfxThreadHandle thread);
gThread gfxThreadCreate(void *stackarea, size_t stacksz, gThreadpriority prio, DECLARE_THREAD_FUNCTION((*fn),p), void *param);
gThreadreturn gfxThreadWait(gThread thread);
#endif /* GFX_USE_OS_LINUX */

View File

@ -92,8 +92,8 @@ gTicks gfxSystemTicks(void) {
return ts.tv_sec * 1000UL + ts.tv_nsec / 1000000;
}
gfxThreadHandle gfxThreadCreate(void *stackarea, size_t stacksz, gThreadpriority prio, DECLARE_THREAD_FUNCTION((*fn),p), void *param) {
gfxThreadHandle th;
gThread gfxThreadCreate(void *stackarea, size_t stacksz, gThreadpriority prio, DECLARE_THREAD_FUNCTION((*fn),p), void *param) {
gThread th;
(void) stackarea;
(void) stacksz;
(void) prio;
@ -110,7 +110,7 @@ gfxThreadHandle gfxThreadCreate(void *stackarea, size_t stacksz, gThreadpriority
return th;
}
gThreadreturn gfxThreadWait(gfxThreadHandle thread) {
gThreadreturn gfxThreadWait(gThread thread) {
gThreadreturn retval;
if (pthread_join(thread, &retval))

View File

@ -17,7 +17,7 @@
typedef unsigned long gTicks;
typedef void * gThreadreturn;
typedef unsigned long gDelay;
typedef pthread_t gfxThreadHandle;
typedef pthread_t gThread;
typedef int gThreadpriority;
typedef uint32_t gSemcount;
typedef pthread_mutex_t gfxMutex;
@ -69,8 +69,8 @@ void gfxSemInit(gfxSem *psem, gSemcount val, gSemcount limit);
void gfxSemDestroy(gfxSem *psem);
gBool gfxSemWait(gfxSem *psem, gDelay ms);
void gfxSemSignal(gfxSem *psem);
gfxThreadHandle gfxThreadCreate(void *stackarea, size_t stacksz, gThreadpriority prio, DECLARE_THREAD_FUNCTION((*fn),p), void *param);
gThreadreturn gfxThreadWait(gfxThreadHandle thread);
gThread gfxThreadCreate(void *stackarea, size_t stacksz, gThreadpriority prio, DECLARE_THREAD_FUNCTION((*fn),p), void *param);
gThreadreturn gfxThreadWait(gThread thread);
#endif /* GFX_USE_OS_OSX */
#endif /* _GOS_OSX_H */

View File

@ -185,7 +185,7 @@ void gfxSemSignalI(gfxSem *psem)
static_cast<QSemaphore*>(*psem)->release(1);
}
gfxThreadHandle gfxThreadCreate(void *stackarea, size_t stacksz, gThreadpriority prio, DECLARE_THREAD_FUNCTION((*fn),p), void *param)
gThread gfxThreadCreate(void *stackarea, size_t stacksz, gThreadpriority prio, DECLARE_THREAD_FUNCTION((*fn),p), void *param)
{
Q_UNUSED(stackarea)
@ -196,10 +196,10 @@ gfxThreadHandle gfxThreadCreate(void *stackarea, size_t stacksz, gThreadpriority
}
thread->start(static_cast<QThread::Priority>(prio));
return static_cast<gfxThreadHandle>(thread);
return static_cast<gThread>(thread);
}
gThreadreturn gfxThreadWait(gfxThreadHandle thread)
gThreadreturn gfxThreadWait(gThread thread)
{
Thread* t = static_cast<Thread*>(thread);
@ -210,12 +210,12 @@ gThreadreturn gfxThreadWait(gfxThreadHandle thread)
return returnValue;
}
gfxThreadHandle gfxThreadMe(void)
gThread gfxThreadMe(void)
{
return static_cast<Thread*>(QThread::currentThread());
}
void gfxThreadClose(gfxThreadHandle thread)
void gfxThreadClose(gThread thread)
{
static_cast<Thread*>(thread)->exit();
}

View File

@ -28,7 +28,7 @@ typedef void* gfxSem;
typedef int gSemcount;
typedef int gThreadreturn;
typedef int gThreadpriority;
typedef void* gfxThreadHandle;
typedef void* gThread;
void _gosInit();
void _gosDeinit();
@ -55,10 +55,10 @@ gBool gfxSemWait(gfxSem *psem, gDelay ms);
gBool gfxSemWaitI(gfxSem *psem);
void gfxSemSignal(gfxSem *psem);
void gfxSemSignalI(gfxSem *psem);
gfxThreadHandle gfxThreadCreate(void *stackarea, size_t stacksz, gThreadpriority prio, DECLARE_THREAD_FUNCTION((*fn),p), void *param);
gThreadreturn gfxThreadWait(gfxThreadHandle thread);
gfxThreadHandle gfxThreadMe(void);
void gfxThreadClose(gfxThreadHandle thread);
gThread gfxThreadCreate(void *stackarea, size_t stacksz, gThreadpriority prio, DECLARE_THREAD_FUNCTION((*fn),p), void *param);
gThreadreturn gfxThreadWait(gThread thread);
gThread gfxThreadMe(void);
void gfxThreadClose(gThread thread);
#endif /* GFX_USE_OS_QT */
#endif /* _GOS_QT_H */

View File

@ -75,10 +75,10 @@ gBool gfxSemWaitI(gfxSem* psem)
return gFalse;
}
gfxThreadHandle gfxThreadCreate(void *stackarea, size_t stacksz, gThreadpriority prio, DECLARE_THREAD_FUNCTION((*fn),p), void *param)
gThread gfxThreadCreate(void *stackarea, size_t stacksz, gThreadpriority prio, DECLARE_THREAD_FUNCTION((*fn),p), void *param)
{
RAW_U16 ret;
gfxThreadHandle taskobj;
gThread taskobj;
taskobj = gfxAlloc(sizeof(RAW_TASK_OBJ));
ret = raw_task_create(taskobj, (RAW_U8 *)"uGFX_TASK", param,

View File

@ -20,7 +20,7 @@ typedef RAW_U8 gThreadpriority;
typedef RAW_SEMAPHORE gfxSem;
typedef RAW_MUTEX gfxMutex;
typedef RAW_TASK_OBJ* gfxThreadHandle;
typedef RAW_TASK_OBJ* gThread;
#define DECLARE_THREAD_FUNCTION(fnName, param) gThreadreturn fnName(void *param)
#define DECLARE_THREAD_STACK(name, sz) PORT_STACK name[(sz) & ~3];
@ -67,7 +67,7 @@ void gfxSleepMilliseconds(gDelay ms);
void gfxSleepMicroseconds(gDelay us);
gBool gfxSemWait(gfxSem* psem, gDelay ms);
gBool gfxSemWaitI(gfxSem* psem);
gfxThreadHandle gfxThreadCreate(void *stackarea, size_t stacksz, gThreadpriority prio, DECLARE_THREAD_FUNCTION((*fn),p), void *param);
gThread gfxThreadCreate(void *stackarea, size_t stacksz, gThreadpriority prio, DECLARE_THREAD_FUNCTION((*fn),p), void *param);
#endif

View File

@ -103,7 +103,7 @@ gSemcount gfxSemCounter(gfxSem *pSem) {
}
*/
gfxThreadHandle gfxThreadCreate(void *stackarea, size_t stacksz, gThreadpriority prio, DECLARE_THREAD_FUNCTION(*fn,p), void *param) {
gThread gfxThreadCreate(void *stackarea, size_t stacksz, gThreadpriority prio, DECLARE_THREAD_FUNCTION(*fn,p), void *param) {
(void) stackarea;
HANDLE thd;
@ -116,7 +116,7 @@ gfxThreadHandle gfxThreadCreate(void *stackarea, size_t stacksz, gThreadpriority
return thd;
}
gThreadreturn gfxThreadWait(gfxThreadHandle thread) {
gThreadreturn gfxThreadWait(gThread thread) {
DWORD ret;
WaitForSingleObject(thread, INFINITE);

View File

@ -44,7 +44,7 @@ typedef int gThreadpriority;
typedef HANDLE gfxSem;
typedef HANDLE gfxMutex;
typedef HANDLE gfxThreadHandle;
typedef HANDLE gThread;
#define gfxExit() ExitProcess(0)
#define gfxAlloc(sz) malloc(sz)
@ -75,8 +75,8 @@ void gfxSleepMicroseconds(gDelay ms);
gBool gfxSemWait(gfxSem *psem, gDelay ms);
void gfxSystemLock(void);
void gfxSystemUnlock(void);
gfxThreadHandle gfxThreadCreate(void *stackarea, size_t stacksz, gThreadpriority prio, DECLARE_THREAD_FUNCTION(*fn,p), void *param);
gThreadreturn gfxThreadWait(gfxThreadHandle thread);
gThread gfxThreadCreate(void *stackarea, size_t stacksz, gThreadpriority prio, DECLARE_THREAD_FUNCTION(*fn,p), void *param);
gThreadreturn gfxThreadWait(gThread thread);
#endif /* GFX_USE_OS_WIN32 */
#endif /* _GOS_WIN32_H */

View File

@ -457,8 +457,8 @@ void _gosThreadsInit(void) {
_gfxCurrentThread = &mainthread;
}
gfxThreadHandle gfxThreadMe(void) {
return (gfxThreadHandle)_gfxCurrentThread;
gThread gfxThreadMe(void) {
return (gThread)_gfxCurrentThread;
}
// Check if there are dead processes to deallocate
@ -508,7 +508,7 @@ void gfxThreadExit(gThreadreturn ret) {
// We never get back here as we didn't re-queue ourselves
}
gfxThreadHandle gfxThreadCreate(void *stackarea, size_t stacksz, gThreadpriority prio, DECLARE_THREAD_FUNCTION((*fn),p), void *param) {
gThread gfxThreadCreate(void *stackarea, size_t stacksz, gThreadpriority prio, DECLARE_THREAD_FUNCTION((*fn),p), void *param) {
thread * t;
thread * me;
(void) prio;
@ -543,7 +543,7 @@ gfxThreadHandle gfxThreadCreate(void *stackarea, size_t stacksz, gThreadpriority
return t;
}
gThreadreturn gfxThreadWait(gfxThreadHandle th) {
gThreadreturn gfxThreadWait(gThread th) {
thread * t;
t = th;

View File

@ -47,7 +47,7 @@ typedef struct {
} gfxSem;
typedef uint32_t gfxMutex;
typedef void * gfxThreadHandle;
typedef void * gThread;
// Required timing functions - supplied by the user or the operating system
gTicks gfxSystemTicks(void);
@ -77,10 +77,10 @@ void gfxSemSignal(gfxSem *psem);
void gfxSemSignalI(gfxSem *psem);
// Threads
gfxThreadHandle gfxThreadCreate(void *stackarea, size_t stacksz, gThreadpriority prio, DECLARE_THREAD_FUNCTION((*fn),p), void *param);
gThread gfxThreadCreate(void *stackarea, size_t stacksz, gThreadpriority prio, DECLARE_THREAD_FUNCTION((*fn),p), void *param);
#define gfxThreadClose(thread)
gThreadreturn gfxThreadWait(gfxThreadHandle thread);
gfxThreadHandle gfxThreadMe(void);
gThreadreturn gfxThreadWait(gThread thread);
gThread gfxThreadMe(void);
/** The following is not part of the public ugfx API as some operating systems
* simply do not provide this capability.

View File

@ -41,7 +41,7 @@ typedef struct k_sem gfxSem;
typedef struct k_mutex gfxMutex;
typedef k_tid_t gfxThreadHandle;
typedef k_tid_t gThread;
/*===========================================================================*/
/* Function declarations. */

View File

@ -19,7 +19,7 @@
/* This mutex protects access to our tables */
static gfxMutex mutex;
static gfxThreadHandle hThread = 0;
static gThread hThread = 0;
static GTimer *pTimerHead = 0;
static gfxSem waitsem;
static gTicks ticks2ms;