# How to handle keyboard in worker thread in XNA

I am using multithreading in my XNA application and run my update logic s in a update thread(witch is a worker thread) and rendring is being done by main thread, now the problem is updation is required there on keyboard event, and key Board handling can be done only in main thread.

Note that my application was single threaded and I have implemented threading, synchronization is being done by 'data partitioning', both the threads are working correctly, except my keyboard is not working..

if any one have any suggestion or example, please allow me to know.

Input in XNA is not thread-safe and must be handled on the main thread. Simple as that.

This is the thread safety of the XNA Framework (info is from XNA 3.1, but is probably still applicable):

• GraphicsDevice is somewhat thread-safe

• Cannot render from more than one thread at a time
• Can create resources and SetData while another thread renders
• ContentManager is not thread-safe

• Ok to have multiple instances, but only one per thread