From 17c940423ba2159b20965ea6d004386bc392aa68 Mon Sep 17 00:00:00 2001 From: inmarket Date: Fri, 23 Oct 2015 18:23:57 +1000 Subject: More thread return fixes --- src/gos/gos.h | 10 ++++++++++ src/gos/gos_freertos.h | 1 + src/gos/gos_osx.h | 2 +- 3 files changed, 12 insertions(+), 1 deletion(-) (limited to 'src/gos') 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) -- cgit v1.2.3