In TCC I am not sure how you are doing a thread. If you have the thread you should wait for the thread to end before you proceed to end in main.