Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void* blue(struct image *img)
- {
- printf("Launching blue filtern");
- if (filter_blue(img))
- {
- perror("Error calling filter_blue");
- pthread_exit((void*)1);
- }
- pthread_exit(NULL);
- }
- // in main file:
- pthread_t thread[parameters.num_threads];
- pthread_attr_t attr;
- pthread_attr_init(&attr);
- pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
- for (j=parameters->num_threads - parameters->num_threads_left; count < img->blue_threads ; j++)
- {
- pthread_create(&thread[j], &attr, (void*)blue, img);
- printf("blue foundn");
- count++;
- }
- void *status;
- for (i=0; i<num_thread; i++)
- {
- int a = pthread_join(thread[i], &status);
- printf("pthread join return value: %d n",a);
- }
- pthread_attr_destroy(&attr);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement