aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/multiple/Win32/gdisp_lld_Win32.c
diff options
context:
space:
mode:
authorinmarket <andrewh@inmarket.com.au>2013-12-21 11:20:30 +1000
committerinmarket <andrewh@inmarket.com.au>2013-12-21 11:20:30 +1000
commit018a930d5525ffefc30fb2514752918455853685 (patch)
tree36c4d4baa8efb5fba60fb09e13174c4e10bc5270 /drivers/multiple/Win32/gdisp_lld_Win32.c
parent3ea191e83599bad71dd95e5048ccd61351730f1c (diff)
downloaduGFX-018a930d5525ffefc30fb2514752918455853685.tar.gz
uGFX-018a930d5525ffefc30fb2514752918455853685.tar.bz2
uGFX-018a930d5525ffefc30fb2514752918455853685.zip
Always use native threads in the Win32 driver even if a different threading model is being used for the rest of uGFX
Diffstat (limited to 'drivers/multiple/Win32/gdisp_lld_Win32.c')
-rw-r--r--drivers/multiple/Win32/gdisp_lld_Win32.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/drivers/multiple/Win32/gdisp_lld_Win32.c b/drivers/multiple/Win32/gdisp_lld_Win32.c
index eb74f4bf..21405668 100644
--- a/drivers/multiple/Win32/gdisp_lld_Win32.c
+++ b/drivers/multiple/Win32/gdisp_lld_Win32.c
@@ -343,8 +343,7 @@ static LRESULT myWindowProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
return 0;
}
-static DECLARE_THREAD_STACK(waWindowThread, 1024);
-static DECLARE_THREAD_FUNCTION(WindowThread, param) {
+static DWORD WINAPI WindowThread(void *param) {
(void)param;
MSG msg;
@@ -399,16 +398,19 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) {
// Initialise the window thread and the window class (if it hasn't been done already)
if (!QReady) {
- gfxThreadHandle hth;
+ HANDLE hth;
WNDCLASS wc;
// Create the draw mutex
drawMutex = CreateMutex(NULL, FALSE, NULL);
// Create the thread
- hth = gfxThreadCreate(waWindowThread, sizeof(waWindowThread), HIGH_PRIORITY, WindowThread, 0);
- assert(hth != NULL);
- gfxThreadClose(hth);
+ if (!(hth = CreateThread(NULL, 0, WindowThread, 0, CREATE_SUSPENDED, NULL)))
+ return FALSE;
+
+ SetThreadPriority(hth, THREAD_PRIORITY_ABOVE_NORMAL);
+ ResumeThread(hth);
+ CloseHandle(hth);
wc.style = CS_HREDRAW | CS_VREDRAW; // | CS_OWNDC;
wc.lpfnWndProc = (WNDPROC)myWindowProc;
@@ -425,7 +427,7 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) {
// Wait for our thread to be ready
while (!QReady)
- gfxSleepMilliseconds(1);
+ Sleep(1);
}
// Initialise the GDISP structure
@@ -466,7 +468,7 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) {
// Wait for the window creation to complete (for safety)
while(!(((volatile GDisplay *)g)->flags & GDISP_FLG_READY))
- gfxSleepMilliseconds(1);
+ Sleep(1);
sprintf(buf, APP_NAME " - %u", g->systemdisplay+1);
SetWindowText(priv->hwnd, buf);