private volatile bool threadExit; // Any variable that can be changed by other threads has to be volatile (if not using lock) #endregion Fields #region Constructors public MouseInputProcessor() { ConfigureLogManager(); handleRequests = new Semaphore(0, (int)SemaphoreConstants.MAX_CONCURRENT_REQUESTS); requestMouseData = new Semaphore((int)SemaphoreConstants.MAX_CONCURRENT_REQUESTS, (int)SemaphoreConstants.MAX_CONCURRENT_REQUESTS); sendInput = new KeyboardSendInput(); gameOperation = new GameDataProcessor(); dataQueue = new Queue<MouseData>(); threadExit = false; mouseProcessorThread = new Thread(HandleMouseInput); mouseProcessorThread.Name = "MouseProcessorThread"; mouseProcessorThread.Start(); }
private volatile bool threadExit; // Any variable that can be changed by other threads has to be volatile (if not using lock) #endregion Fields #region Constructors public KeyboardInputProcessor() { ConfigureLogManager(); handleRequests = new Semaphore(0, (int)SemaphoreConstants.MAX_CONCURRENT_REQUESTS); requestKeyboardData = new Semaphore((int)SemaphoreConstants.MAX_CONCURRENT_REQUESTS, (int)SemaphoreConstants.MAX_CONCURRENT_REQUESTS); sendInput = new KeyboardSendInput(); gameOperation = new GameDataProcessor(); dataQueue = new Queue<KeyboardData>(); threadExit = false; keysPressed = new List<int>(); keyboardProcessorThread = new Thread(HandleKeyBoardInput); keyboardProcessorThread.Name = "KeyboardProcessorThread"; keyboardProcessorThread.Start(); }