Jump to content
  • Advertisement
Sign in to follow this  

C# Windows Forms application with background threads

This topic is 2781 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts


I'm trying to figure out the architecture for my next app. It needs to be a windows forms app which behaves just like a normal GUI application, but it also needs to read an Xbox 360 controller and send/receive data on serial ports quickly and continuously (something like [10 * a few bytes] per second or so). So this is what I have so far, but please correct me if I'm wrong and suggest something better if this is bad design:

- The main application is a normal winforms app, runs in the main thread
- One worker thread is responsible for reading the X360 controller (eg. through SlimDX) and passing the events to the main thread
- The main thread also has a list of what I call processors. A processor is:
- A worker thread
- Owns a connection to a COM port
- Receives data from the COM port and passes it to the main thread
- Receives data from the main thread and writes it to the COM port
- There can be a few (prolly 3-4) processors in work at once.

Does this sound feasible? How should I go about thread synchronization? Does .NET have any lock-free queues or similar built in? Any other ideas?


Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!