diff options
-rw-r--r-- | src/gos/gos.h | 10 | ||||
-rw-r--r-- | src/gos/gos_freertos.h | 1 | ||||
-rw-r--r-- | src/gos/gos_osx.h | 2 | ||||
-rw-r--r-- | src/gtimer/gtimer.c | 5 |
4 files changed, 14 insertions, 4 deletions
diff --git a/src/gos/gos.h b/src/gos/gos.h index 82ad9d1c..048d5765 100644 --- a/src/gos/gos.h +++ b/src/gos/gos.h @@ -69,6 +69,16 @@ */ #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 * @note Your platform may use slightly different definitions to these diff --git a/src/gos/gos_freertos.h b/src/gos/gos_freertos.h index 574e13ae..9b3d1023 100644 --- a/src/gos/gos_freertos.h +++ b/src/gos/gos_freertos.h @@ -63,6 +63,7 @@ typedef portBASE_TYPE threadpriority_t; #define DECLARE_THREAD_STACK(name, sz) size_t *name = (size_t *)sz #define DECLARE_THREAD_FUNCTION(fnName, param) threadreturn_t fnName(void *param) #define THREAD_RETURN(retval) + portTickType MS2ST(portTickType ms); typedef struct { diff --git a/src/gos/gos_osx.h b/src/gos/gos_osx.h index e5764b81..44853937 100644 --- a/src/gos/gos_osx.h +++ b/src/gos/gos_osx.h @@ -27,7 +27,7 @@ typedef pthread_mutex_t gfxMutex; #define DECLARE_THREAD_FUNCTION(fnName, param) threadreturn_t fnName(void *param) #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 gfxAlloc(sz) malloc(sz) diff --git a/src/gtimer/gtimer.c b/src/gtimer/gtimer.c index 6a4705d2..1759ce4d 100644 --- a/src/gtimer/gtimer.c +++ b/src/gtimer/gtimer.c @@ -35,8 +35,7 @@ static DECLARE_THREAD_FUNCTION(GTimerThreadHandler, arg) { systemticks_t lastTime; GTimerFunction fn; void *param; - - (void)arg; + (void) arg; nxtTimeout = TIME_INFINITE; lastTime = 0; @@ -109,7 +108,7 @@ static DECLARE_THREAD_FUNCTION(GTimerThreadHandler, arg) { lastTime = tm; gfxMutexExit(&mutex); } - return 0; + THREAD_RETURN(0); } void _gtimerInit(void) |