From c8deeb938a05e0d87d6b3e3d551562d6fd535711 Mon Sep 17 00:00:00 2001 From: evilC Date: Sun, 25 Mar 2018 16:45:49 +0100 Subject: [PATCH] Subscription callbacks handled by thread pool --- C#/AutoHotInterception/InterceptionWrapper.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/C#/AutoHotInterception/InterceptionWrapper.cs b/C#/AutoHotInterception/InterceptionWrapper.cs index 87ab5ff..87f2841 100644 --- a/C#/AutoHotInterception/InterceptionWrapper.cs +++ b/C#/AutoHotInterception/InterceptionWrapper.cs @@ -265,7 +265,8 @@ public class InterceptionWrapper : IDisposable { block = true; } - mapping.Callback(1 - state); + + ThreadPool.QueueUserWorkItem(threadProc => mapping.Callback(1 - state)); } } // If this key had no subscriptions, but Context Mode is set for this keyboard... @@ -320,7 +321,7 @@ public class InterceptionWrapper : IDisposable { block = true; } - mapping.Callback(2 - state); + ThreadPool.QueueUserWorkItem(threadProc => mapping.Callback(2 - state)); } //Debug.WriteLine($"AHK| Mouse {i} seen - button {btn}, state: {state}"); } @@ -335,7 +336,7 @@ public class InterceptionWrapper : IDisposable block = true; } - mapping.Callback(stroke.mouse.x, stroke.mouse.y); + ThreadPool.QueueUserWorkItem(threadProc => mapping.Callback(stroke.mouse.x, stroke.mouse.y)); } } // If this key had no subscriptions, but Context Mode is set for this mouse...