Advertisement
Guest User

Untitled

a guest
Apr 20th, 2014
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. void* blue(struct image *img)
  2. {
  3. printf("Launching blue filtern");
  4. if (filter_blue(img))
  5. {
  6. perror("Error calling filter_blue");
  7. pthread_exit((void*)1);
  8. }
  9. pthread_exit(NULL);
  10. }
  11.  
  12. // in main file:
  13. pthread_t thread[parameters.num_threads];
  14. pthread_attr_t attr;
  15. pthread_attr_init(&attr);
  16. pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
  17. for (j=parameters->num_threads - parameters->num_threads_left; count < img->blue_threads ; j++)
  18. {
  19. pthread_create(&thread[j], &attr, (void*)blue, img);
  20. printf("blue foundn");
  21. count++;
  22. }
  23.  
  24. void *status;
  25. for (i=0; i<num_thread; i++)
  26. {
  27. int a = pthread_join(thread[i], &status);
  28. printf("pthread join return value: %d n",a);
  29. }
  30. pthread_attr_destroy(&attr);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement