aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorinmarket <andrewh@inmarket.com.au>2015-10-23 18:23:57 +1000
committerinmarket <andrewh@inmarket.com.au>2015-10-23 18:23:57 +1000
commit17c940423ba2159b20965ea6d004386bc392aa68 (patch)
tree46d629c13eef49ad5b65be7b0bc1f8ed171de21e /src
parent83e51779ed7f84a81de1a05e86834577a0e57438 (diff)
downloaduGFX-17c940423ba2159b20965ea6d004386bc392aa68.tar.gz
uGFX-17c940423ba2159b20965ea6d004386bc392aa68.tar.bz2
uGFX-17c940423ba2159b20965ea6d004386bc392aa68.zip
More thread return fixes
Diffstat (limited to 'src')
-rw-r--r--src/gos/gos.h10
-rw-r--r--src/gos/gos_freertos.h1
-rw-r--r--src/gos/gos_osx.h2
-rw-r--r--src/gtimer/gtimer.c5
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)