C multithreading and image manipulation practice