January 5th, 2013, 01:47 PM
Creating a thread
I wrote the following code:
Unfortunately, This code pass compilation, but it doesn't print anything on the screen. I was trying to put a breakpint, and once I operate the debug mode (F5), the program breaks down.
void ThreadFunction (int* index)
(*index) = (*index)+1;
ReadPicThread=CreateThread( NULL, 0 /*use default stack size*/, (LPTHREAD_START_ROUTINE) ThreadFunction /* thread function*/,
&index /* argument to thread function */,0 ,NULL /* returns the thread identifier */ );
What is the problem ?
Last edited by MatanBarLev; January 5th, 2013 at 02:30 PM.
January 5th, 2013, 04:16 PM
If you get any error messages you should post them.
On which line exactly does it break down?
You should also control if CreateThread succeeded the call by checking the value in ReadPicThread for a NULL value.