I am trying to do a simple loop where the user can enter a command and the application fires off an event. My problem is that cin isn't blocking and the loop just keeps going until it crashes.
What are you talking about?? The loop you made will loop forever. If you're getting input from a file, you should make the if condition based on whether or not you've read till the end of the file.
Standard streams will enter an error state (not only) when the end-of-input is reached.
At a terminal, the end-of-input can be signaled by the user by pressing Ctrl-D (on Unix systems) or Return followed by Ctrl-Z followed by Return (on Windows).
$ ./test
Enter a command (q to quit): command1
Do this shit...
Enter a command (q to quit): command2
Do the other shit...
Enter a command (q to quit): whatever
Unknown command. Try again.
Enter a command (q to quit): q
Good bye!
For a thread you might decide to call 'thread_xyz' in main (say), after you start it make the next line thread_xyz.join() if you want to wait for the cin to 'work'.
It does in fact stop and wait for the thread to complete.