Always use native threads in the Win32 driver even if a different threading model is being used for the rest of uGFX
This commit is contained in:
parent
3ea191e835
commit
018a930d55
1 changed files with 10 additions and 8 deletions
|
@ -343,8 +343,7 @@ static LRESULT myWindowProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static DECLARE_THREAD_STACK(waWindowThread, 1024);
|
static DWORD WINAPI WindowThread(void *param) {
|
||||||
static DECLARE_THREAD_FUNCTION(WindowThread, param) {
|
|
||||||
(void)param;
|
(void)param;
|
||||||
MSG msg;
|
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)
|
// Initialise the window thread and the window class (if it hasn't been done already)
|
||||||
if (!QReady) {
|
if (!QReady) {
|
||||||
gfxThreadHandle hth;
|
HANDLE hth;
|
||||||
WNDCLASS wc;
|
WNDCLASS wc;
|
||||||
|
|
||||||
// Create the draw mutex
|
// Create the draw mutex
|
||||||
drawMutex = CreateMutex(NULL, FALSE, NULL);
|
drawMutex = CreateMutex(NULL, FALSE, NULL);
|
||||||
|
|
||||||
// Create the thread
|
// Create the thread
|
||||||
hth = gfxThreadCreate(waWindowThread, sizeof(waWindowThread), HIGH_PRIORITY, WindowThread, 0);
|
if (!(hth = CreateThread(NULL, 0, WindowThread, 0, CREATE_SUSPENDED, NULL)))
|
||||||
assert(hth != NULL);
|
return FALSE;
|
||||||
gfxThreadClose(hth);
|
|
||||||
|
SetThreadPriority(hth, THREAD_PRIORITY_ABOVE_NORMAL);
|
||||||
|
ResumeThread(hth);
|
||||||
|
CloseHandle(hth);
|
||||||
|
|
||||||
wc.style = CS_HREDRAW | CS_VREDRAW; // | CS_OWNDC;
|
wc.style = CS_HREDRAW | CS_VREDRAW; // | CS_OWNDC;
|
||||||
wc.lpfnWndProc = (WNDPROC)myWindowProc;
|
wc.lpfnWndProc = (WNDPROC)myWindowProc;
|
||||||
|
@ -425,7 +427,7 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) {
|
||||||
|
|
||||||
// Wait for our thread to be ready
|
// Wait for our thread to be ready
|
||||||
while (!QReady)
|
while (!QReady)
|
||||||
gfxSleepMilliseconds(1);
|
Sleep(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initialise the GDISP structure
|
// 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)
|
// Wait for the window creation to complete (for safety)
|
||||||
while(!(((volatile GDisplay *)g)->flags & GDISP_FLG_READY))
|
while(!(((volatile GDisplay *)g)->flags & GDISP_FLG_READY))
|
||||||
gfxSleepMilliseconds(1);
|
Sleep(1);
|
||||||
|
|
||||||
sprintf(buf, APP_NAME " - %u", g->systemdisplay+1);
|
sprintf(buf, APP_NAME " - %u", g->systemdisplay+1);
|
||||||
SetWindowText(priv->hwnd, buf);
|
SetWindowText(priv->hwnd, buf);
|
||||||
|
|
Loading…
Add table
Reference in a new issue