Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- for(int i = 0; i < NUMBER_OF_THREADS; i++){
- pthread_mutex_lock(&lock);
- if(pthread_join(tid[i],(void **) &value[i]) == 0){
- sum = sum + value[i]; //add four sums together
- }
- else{
- pthread_mutex_unlock(&lock);
- }
- pthread_mutex_unlock(&lock);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement