There is one more problem : if I use break, the program hangs and I have
to physically kill it using “kill” and CTRL-C does not work. However, if
I use ‘exit’ instead of ‘break’, then the program terminates properly.
However, for my purpose, I would like to use break. Any suggestion here?
Are you cleaning up properly before you exit your main function? If not, it is pretty obvious why the program hangs!