Hi, I'm making a console application, text based game, and what I need to do is be able to do more than one thing at the same time. For example, I need to be able to make a timer that runs constantly, whilst the game is being played. I also need to be able to print stuff to the screen whilst constantly listening for user input. I heard I could do this with multithreading (which apparently is very complicated). Is there any other way to do this? If not, where should I start to learn about threads and multithreading (I have never used threads/anything like this before)?

I heard I could do this with multithreading (which apparently is very complicated).

You heard correctly. While threading is conceptually very simple, the subtle and difficult to trace errors of shared data access makes it among the harder things that most programmers have to deal with.

Is there any other way to do this?

Not if your goal is to avoid the complexity of threads. Other methods of achieving concurrency are just as complicated.

If not, where should I start to learn about threads and multithreading (I have never used threads/anything like this before)?

Have you tried Google?

You heard correctly. While threading is conceptually very simple, the subtle and difficult to trace errors of shared data access makes it among the harder things that most programmers have to deal with.


Not if your goal is to avoid the complexity of threads. Other methods of achieving concurrency are just as complicated.


Have you tried Google?

Ok, I managed to get it working with the help of this website:

http://www.codeproject.com/KB/threads/MultithreadingTutorial.aspx

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.