I am combining GTK+, WinAPI and Winsock to create a graphical client-server interface, a waiting room. nUsers
is a variable that determines the number of clients successfully connected.
Within a Windows thread, created by:
CreateThread(NULL, 0, action_to_users, NULL, 0, NULL);
I use the do-nothing while loop so that it freezes until a user connects.
while(!nUsers);
However, it never passes through the loop as if nUsers
never becomes > 0.nUsers
counts the number of clients connected properly, as I constantly monitor it and use it in a variety of different functions.
To prove my point, something even stranger happens.
If I make the loop
while(!nUsers) { printf("(%i)\n", nUsers); }
To spam the console with text printed out (doesn't matter what text as long as it is not an empty string) it works as intended.
What could be possibly going on here...