Thread exited with code 1 (0x1)

Hi,

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

WaitForMultipleObjects(THREADCOUNT, aThread, TRUE, INFINITE);

// Close thread and mutex handles

for( i=0; i < THREADCOUNT; i++ )
CloseHandle(aThread[i]);

Please let me know why I am getting this and correct me.

Thanks in Advance,
Ferdinend LMG
What return code did your thread set?
Check kbw's point first.

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?

Topic archived. No new replies allowed.