Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Is there anything wrong with a WHILE statement in a thread?  (Read 4545 times)

0 Members and 1 Guest are viewing this topic.

spacechase0

  • Newbie
  • *
  • Posts: 39
    • AOL Instant Messenger - thespacechase0
    • View Profile
    • http://spacechase0.com/
Is there anything wrong with a WHILE statement in a thread?
« on: January 04, 2010, 02:05:38 am »
Also, would it be bad to put a blocking function (i.e Receive() in sf::Socket) in that while loop?

OniLinkPlus

  • Hero Member
  • *****
  • Posts: 500
    • View Profile
Is there anything wrong with a WHILE statement in a thread?
« Reply #1 on: January 04, 2010, 02:39:24 am »
There is nothing wrong with having a while statement in a thread, as long as it doesn't enter an infinite loop. Putting a blocking function in there will freeze up the thread if you don't receive any data. It wouldn't be bad if you are sure you will receive data.
I use the latest build of SFML2

spacechase0

  • Newbie
  • *
  • Posts: 39
    • AOL Instant Messenger - thespacechase0
    • View Profile
    • http://spacechase0.com/
Is there anything wrong with a WHILE statement in a thread?
« Reply #2 on: January 04, 2010, 02:42:20 am »
Good, thanks. :)