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.
This commit is contained in:
parent
b669bf98f1
commit
9da1afa34a
@ -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;
|
||||
|
||||
|
@ -145,6 +145,10 @@ void ginputInvertToggle(uint16_t instance, bool_t invert) {
|
||||
* Returns FALSE on error (eg invalid instance)
|
||||
*/
|
||||
bool_t ginputGetToggleStatus(uint16_t instance, GEventToggle *ptoggle) {
|
||||
// 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 >= GINPUT_TOGGLE_NUM_PORTS)
|
||||
return FALSE;
|
||||
ptoggle->type = GEVENT_TOGGLE;
|
||||
|
Loading…
Reference in New Issue
Block a user