Added some code for waiting thread to be launched (for STDIN from file)