aboutsummaryrefslogtreecommitdiffstats
path: root/src/gtimer
diff options
context:
space:
mode:
authorinmarket <andrewh@inmarket.com.au>2013-06-02 18:57:22 +1000
committerinmarket <andrewh@inmarket.com.au>2013-06-02 18:57:22 +1000
commit1c258a82738e145953fc9cf40c68dcce6db87d92 (patch)
treec151e882619714d696276ce29ef3388dce6e1866 /src/gtimer
parentc2a4f9a5d616f5b18a965652d7492aacd377e5e2 (diff)
downloaduGFX-1c258a82738e145953fc9cf40c68dcce6db87d92.tar.gz
uGFX-1c258a82738e145953fc9cf40c68dcce6db87d92.tar.bz2
uGFX-1c258a82738e145953fc9cf40c68dcce6db87d92.zip
GOS updates
Diffstat (limited to 'src/gtimer')
-rw-r--r--src/gtimer/gtimer.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/gtimer/gtimer.c b/src/gtimer/gtimer.c
index 366ca4a9..1de1ce45 100644
--- a/src/gtimer/gtimer.c
+++ b/src/gtimer/gtimer.c
@@ -26,16 +26,16 @@
/* This mutex protects access to our tables */
static gfxMutex mutex;
-static bool_t haveThread = 0;
+static gfxThreadHandle hThread = 0;
static GTimer *pTimerHead = 0;
static gfxSem waitsem;
-static DECLARESTACK(waTimerThread, GTIMER_THREAD_WORKAREA_SIZE);
+static DECLARE_THREAD_STACK(waTimerThread, GTIMER_THREAD_WORKAREA_SIZE);
/*===========================================================================*/
/* Driver local functions. */
/*===========================================================================*/
-static threadreturn_t GTimerThreadHandler(void *arg) {
+static DECLARE_THREAD_FUNCTION(GTimerThreadHandler, arg) {
(void)arg;
GTimer *pt;
systemticks_t tm;
@@ -131,8 +131,10 @@ void gtimerStart(GTimer *pt, GTimerFunction fn, void *param, bool_t periodic, de
gfxMutexEnter(&mutex);
// Start our thread if not already going
- if (!haveThread)
- haveThread = gfxCreateThread(waTimerThread, sizeof(waTimerThread), HIGH_PRIORITY, GTimerThreadHandler, NULL);
+ if (!hThread) {
+ hThread = gfxThreadCreate(waTimerThread, sizeof(waTimerThread), HIGH_PRIORITY, GTimerThreadHandler, NULL);
+ if (hThread) gfxThreadClose(hThread); // We never really need the handle again
+ }
// Is this already scheduled?
if (pt->flags & GTIMER_FLG_SCHEDULED) {