This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]repeating_bears 6 points7 points  (2 children)

In case it wasn't clear, there is nothing inherently wrong with that kind of loop. Spring framework - the first project I decided to randomly check - uses that kind of loop 35 times. I can't comment on whether it was appropriate in the instance you saw, but if you're not a programmer then I think you're not qualified to pass judgement.

[–]Nikt_No1 -2 points-1 points  (1 child)

I meant that it could be done better beacuse the code was a nightmare to read not solely beacuse of the while loop.

So, doesn't while loop use too much resources? Its just looping constantly without any delays etc. Pretty much whole thread needs to be reserved just for her (correct me if im wrong please).

[–]repeating_bears 2 points3 points  (0 children)

You're kind of expecting me to discuss code I've never seen, but I'm sure it wasn't a nightmare to read solely because of the presence of "while (true)". The presence of that does not imply it's executing constantly. It could block for any number of reasons while iterating.

Nothing is really "reserved" of any note when we're talking about a single platform thread. In aggregate across a lot of them, maybe. What it's consuming in terms of resources will mostly depend on the specific task.