Added shared structure to manage communication between input handlers and the main thread in the adapter.