Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void method2()
- {
- int i,j;
- struct place *a;
- a=(struct place*)malloc(sizeof(struct place));
- pthread_t threads[rowSize1*colSize2]; /* descriptors of threads */
- for(i = 0; i < rowSize1; i++) /* create threads */
- {
- for(j=0; j<colSize2; j++)
- {
- a->r=i;
- a->c=j;
- if (pthread_create(&threads[i*j], NULL, executeMethod2, (void *)a))
- {
- printf("Can not create a thread\n");
- exit(1);
- }
- }
- }
- for(i = 0; i < rowSize1; i++) /* create threads */
- {
- for(j=0; j<colSize2; j++)
- {
- int value; /* value returned by thread */
- pthread_join(threads[i*j], (void **)&value);
- outputMatrix2[i][j]=value;
- printf("%d ",outputMatrix2[i][j]);
- }
- printf("\n");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement