On Sun, Sep 13, 2009 at 11:46 PM, Vitaliy Margolen <wine-de...@kievinfo.com> wrote: > Forgot this part: >> Ismael Barros wrote: >> +static DWORD WINAPI tcp_listener_thread( LPVOID lpParameter ) >> +{ >> + for ( ;; ) >> + { >> + if ( clientSock == INVALID_SOCKET ) >> + { >> + goto end; >> + } >> + } >> + >> +end: >> +} > It's more cleaner to use "break;" instead of goto to exit the loop.
It's a way to tell between abruptly ending the thread due to an error (so it just executes cleanup code and returns), and ending the thread gracefully (which would be done with a break or a thread termination boolean). In this case is equivalent because there's no code between the end of the loop and the "end" label. If it's better to use always a break I will change it.