Single thread to multi-threaded application

后端 未结 6 1057
南笙
南笙 2021-01-03 17:05

When we should use threads in our application. In other words, when should I convert a single threaded application to multi-threaded application. Being a developer, I think

6条回答
  •  难免孤独
    2021-01-03 18:07

    Main usage of multithreading is, when there is a requirement for parallel code flows.

    Best Example I can give is ball breaker game, in which you have to run an animation to show the ball is moving and take inputs from the user to move the bat.

    Here you will run the animation on a thread and interact with the user on other thread. Which can't be solved by a single thread application.

提交回复
热议问题