changed arg into pointer to int
git-svn-id: svn://anubis/gvsu@172 45c1a28c-8058-47b2-ae61-ca45b979098e
This commit is contained in:
parent
e1666dd72b
commit
7204622be6
@ -96,7 +96,9 @@ int main(int argc, char * argv[])
|
|||||||
|
|
||||||
for (int i = 0; i < num_threads; i++)
|
for (int i = 0; i < num_threads; i++)
|
||||||
{
|
{
|
||||||
int ret = pthread_create(&threads[i], NULL, &calcSimMatrixThread, (void *) i);
|
int * arg = new int;
|
||||||
|
*arg = i;
|
||||||
|
int ret = pthread_create(&threads[i], NULL, &calcSimMatrixThread, arg);
|
||||||
if (ret)
|
if (ret)
|
||||||
{
|
{
|
||||||
cerr << "Error " << ret << " when creating thread!" << endl;
|
cerr << "Error " << ret << " when creating thread!" << endl;
|
||||||
@ -134,7 +136,8 @@ bool readFile(char * fileName, vector<char> & v)
|
|||||||
/* Compute portions of the similarity matrix between two character arrays */
|
/* Compute portions of the similarity matrix between two character arrays */
|
||||||
void * calcSimMatrixThread(void * arg)
|
void * calcSimMatrixThread(void * arg)
|
||||||
{
|
{
|
||||||
int id = (int) arg;
|
int * realarg = (int *) arg;
|
||||||
|
int id = *realarg;
|
||||||
int s_size = s->size();
|
int s_size = s->size();
|
||||||
int t_size = t->size();
|
int t_size = t->size();
|
||||||
int (*F)[s_size][t_size] = (int (*) [s_size][t_size]) matrix;
|
int (*F)[s_size][t_size] = (int (*) [s_size][t_size]) matrix;
|
||||||
@ -187,5 +190,6 @@ void * calcSimMatrixThread(void * arg)
|
|||||||
cout << "Maximum value is " << max_val << " at position ("
|
cout << "Maximum value is " << max_val << " at position ("
|
||||||
<< max_x << ", " << max_y << ")" << endl;
|
<< max_x << ", " << max_y << ")" << endl;
|
||||||
|
|
||||||
|
delete realarg;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user