From 1c258a82738e145953fc9cf40c68dcce6db87d92 Mon Sep 17 00:00:00 2001 From: inmarket Date: Sun, 2 Jun 2013 18:57:22 +1000 Subject: GOS updates --- drivers/multiple/X/gdisp_lld.c | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) (limited to 'drivers/multiple/X/gdisp_lld.c') diff --git a/drivers/multiple/X/gdisp_lld.c b/drivers/multiple/X/gdisp_lld.c index c431c30c..ee436993 100644 --- a/drivers/multiple/X/gdisp_lld.c +++ b/drivers/multiple/X/gdisp_lld.c @@ -117,8 +117,8 @@ static void ProcessEvent(void) { /* this is the X11 thread which keeps track of all events */ #if GDISP_THREAD_CHIBIOS - static DECLARESTACK(waXThread, 1024); - static threadreturn_t ThreadX(void *arg) { + static DECLARE_THREAD_STACK(waXThread, 1024); + static DECLARE_THREAD_FUNCTION(ThreadX, arg) { (void)arg; while(1) { @@ -159,12 +159,12 @@ bool_t gdisp_lld_init(void) XSetWindowAttributes xa; XTextProperty WindowTitle; char * WindowTitleText; - #if !GDISP_THREAD_CHIBIOS + #if GDISP_THREAD_CHIBIOS + gfxThreadHandle hth; + #else pthread_attr_t thattr; pthread_t thid; - #endif - #if !GDISP_THREAD_CHIBIOS XInitThreads(); #endif @@ -228,16 +228,21 @@ bool_t gdisp_lld_init(void) ExposureMask | ButtonPressMask | ButtonReleaseMask | PointerMotionMask); #if GDISP_THREAD_CHIBIOS - if (!gfxCreateThread(waXThread, sizeof(waXThread), HIGH_PRIORITY, ThreadX, 0)) { + if (!(hth = gfxThreadCreate(waXThread, sizeof(waXThread), HIGH_PRIORITY, ThreadX, 0))) { + fprintf(stderr, "Cannot start X Thread\n"); + XCloseDisplay(dis); + exit(0); + } + gfxThreadClose(hth); #else if (pthread_attr_init(&thattr) || pthread_attr_setdetachstate(&thattr, PTHREAD_CREATE_DETACHED) || pthread_create(&thid, &thattr, ThreadX, 0)) { + fprintf(stderr, "Cannot start X Thread\n"); + XCloseDisplay(dis); + exit(0); + } #endif - fprintf(stderr, "Cannot start X Thread\n"); - XCloseDisplay(dis); - exit(0); - } /* Initialise the GDISP structure to match */ GDISP.Orientation = GDISP_ROTATE_0; -- cgit v1.2.3