Is “while (true)” usually used for a permanent thread?

后端 未结 6 1158
温柔的废话
温柔的废话 2021-02-04 07:18

I\'m relatively new to coding; most of my \"work\" has been just simple GUI apps that only function for one thing, so I haven\'t had to thread much.

Anyway, one thing I\

6条回答
  •  抹茶落季
    2021-02-04 08:01

    Yep, that's what you do.

    But typically it's like:

    bool keepRunning = true;
    
    ...
    
    while(keepRunning){
    }
    

    Because sometimes you may like to have someone/something else to have the ability to stop you.

提交回复
热议问题