Multithreading in C and C++