The threads aren't asked to do anything, yet the program crashes after getting part way.
0
thread 0, 175
1
thread 0, 175
2
Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_PROTECTION_FAILURE at address: 0x00000000
suggestions?
0
thread 0, 175
1
thread 0, 175
2
Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_PROTECTION_FAILURE at address: 0x00000000
Code:
pthread_t qthread[Quad_Threads];
long qt;
for (quad = 0; quad < Quad_Threads; quad++)
{
qt = pthread_create(&qthread[quad], NULL, match(tmpimage, tmptarget,innerradius, outerradius,(int)quad, minarray, magx, xshift, yshift), NULL);
if (qt)
{
printf("ERROR; return code from pthread_create() is %ld\n", qt);
exit(-1);
}
else
printf("thread %ld, %d\n", qt, magx);
}
void * match(float *tmpimage,float* tmptarget,int innerradius, int outerradius, int quad, float * minarray, int magx, int xshift, int yshift)
{
int rowstart, colstart, rowend, colend;
float sd;
printf("%d\n", quad);
// rowstart = colstart = innerradius + red_ctr;
// rowend = colend = outerradius + red_ctr;
/* sd = sd_of_difference(tmpimage, tmptarget,rowstart, rowend, colstart, colend);
if (sd < minarray[quad*4])
{
minarray[quad*4] = sd;
minarray[quad*4 + 1] = magx;
minarray[quad*4 + 2] = xshift;
minarray[quad*4 + 3] = yshift;
}
*/
return(0);
}
suggestions?