More thread return fixes

ugfx_release_2.6
inmarket 2015-10-23 18:23:57 +10:00
parent 83e51779ed
commit 17c940423b
4 changed files with 14 additions and 4 deletions

View File

@ -69,6 +69,16 @@
*/ */
#define DECLARE_THREAD_STACK(name, sz) uint8_t name[sz]; #define DECLARE_THREAD_STACK(name, sz) uint8_t name[sz];
/*
* @brief Return from a thread
*
* @details Some underlying operating systems allow to return a value from a thread while others don't.
* For systems that don't allow to return a value from a thread function this call is simply ignored.
*
* @param[in] reval The value which should be returned
*/
#define THREAD_RETURN(retval) return retval
/** /**
* @name Various platform (and operating system) constants * @name Various platform (and operating system) constants
* @note Your platform may use slightly different definitions to these * @note Your platform may use slightly different definitions to these

View File

@ -63,6 +63,7 @@ typedef portBASE_TYPE threadpriority_t;
#define DECLARE_THREAD_STACK(name, sz) size_t *name = (size_t *)sz #define DECLARE_THREAD_STACK(name, sz) size_t *name = (size_t *)sz
#define DECLARE_THREAD_FUNCTION(fnName, param) threadreturn_t fnName(void *param) #define DECLARE_THREAD_FUNCTION(fnName, param) threadreturn_t fnName(void *param)
#define THREAD_RETURN(retval) #define THREAD_RETURN(retval)
portTickType MS2ST(portTickType ms); portTickType MS2ST(portTickType ms);
typedef struct { typedef struct {

View File

@ -27,7 +27,7 @@ typedef pthread_mutex_t gfxMutex;
#define DECLARE_THREAD_FUNCTION(fnName, param) threadreturn_t fnName(void *param) #define DECLARE_THREAD_FUNCTION(fnName, param) threadreturn_t fnName(void *param)
#define DECLARE_THREAD_STACK(name, sz) uint8_t name[0]; #define DECLARE_THREAD_STACK(name, sz) uint8_t name[0];
#define THREAD_RETURN(retval) return reval #define THREAD_RETURN(retval) return retval
#define gfxExit() exit(0) #define gfxExit() exit(0)
#define gfxAlloc(sz) malloc(sz) #define gfxAlloc(sz) malloc(sz)

View File

@ -35,8 +35,7 @@ static DECLARE_THREAD_FUNCTION(GTimerThreadHandler, arg) {
systemticks_t lastTime; systemticks_t lastTime;
GTimerFunction fn; GTimerFunction fn;
void *param; void *param;
(void) arg;
(void)arg;
nxtTimeout = TIME_INFINITE; nxtTimeout = TIME_INFINITE;
lastTime = 0; lastTime = 0;
@ -109,7 +108,7 @@ static DECLARE_THREAD_FUNCTION(GTimerThreadHandler, arg) {
lastTime = tm; lastTime = tm;
gfxMutexExit(&mutex); gfxMutexExit(&mutex);
} }
return 0; THREAD_RETURN(0);
} }
void _gtimerInit(void) void _gtimerInit(void)