I am working with two threads.
At the end of the program I am getting the message in the debug info as,
The thread 'Win32 Thread' (0x898) has exited with code 1 (0x1).
The thread 'Win32 Thread' (0x6e4) has exited with code 1 (0x1).
The program '[3488] Thread_CircularBuffer.exe: Native' has exited with code 0 (0x0).
I think, I should get 0, instead of 1. Isn't it? Please correct me if I am wrong.
Even though, I have added following lines, for the worker thread. i.e,
// Wait for all threads to terminate
My guess would be that your threads aren't finishing before you close the handles to them, this would cause your main function to complete before the threads are closed giving your an error for their return. Are you using the "WaitForMultipleObjects(...)" Function before running your "CloseHandle(...)" loop?