From 9da1afa34ac189c7cc50aedd4df688bd0c9b66d7 Mon Sep 17 00:00:00 2001 From: Andrew Hannam Date: Thu, 20 Dec 2012 18:32:33 +1000 Subject: Using ginput with polling allow thread preemption GINPUT when being exclusively polled by the application, did not allow pre-emption of the main thread and therefore some platforms (Win32) the mouse/toggle stopped working. --- src/ginput/mouse.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/ginput/mouse.c') diff --git a/src/ginput/mouse.c b/src/ginput/mouse.c index 35a55bc5..94734888 100644 --- a/src/ginput/mouse.c +++ b/src/ginput/mouse.c @@ -378,6 +378,10 @@ GSourceHandle ginputGetMouse(uint16_t instance) { } bool_t ginputGetMouseStatus(uint16_t instance, GEventMouse *pe) { + // Win32 threads don't seem to recognise priority and/or pre-emption + // so we add a sleep here to prevent 100% polled applications from locking up. + chThdSleepMilliseconds(1); + if (instance || (MouseConfig.flags & (FLG_INIT_DONE|FLG_IN_CAL)) != FLG_INIT_DONE) return FALSE; -- cgit v1.2.3