Advertisement
Guest User

Untitled

a guest
Oct 13th, 2014
386
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 2.40 KB | None | 0 0
  1. diff --git a/import.c b/import.c
  2. index 011ff6d..ce45d78 100644
  3. --- a/import.c
  4. +++ b/import.c
  5. @@ -122,9 +122,12 @@ strcommonendingwith(const char *a, const char *b, char endc)
  6.  static void *worker(void *arg)
  7.  /* consume masters off the queue */
  8.  {
  9. +    rev_list *local_head = NULL, **local_tail = &local_head;
  10. +    cvstime_t local_skew_vulnerable = 0;
  11. +    int local_total_revisions = 0;
  12. +    
  13.      rev_list *rl;
  14.      analysis_t out = {0, 0};
  15. -    bool keepgoing = true;
  16.  
  17.      for (;;)
  18.      {
  19. @@ -136,40 +139,47 @@ static void *worker(void *arg)
  20.         pthread_mutex_lock(&enqueue_mutex);
  21.  #endif /* THREADS */
  22.     if (fn_head == NULL)
  23. -       keepgoing = false;
  24. -   else
  25. -   {
  26. -       fn = fn_head;
  27. -       fn_head = fn_head->next;
  28. -       filename = fn->file;
  29. -       free((rev_filename *)fn);
  30. -   }
  31. +       break;
  32. +   fn = fn_head;
  33. +   fn_head = fn_head->next;
  34. +   filename = fn->file;
  35. +   free((rev_filename *)fn);
  36. +   progress_jump(++load_current_file);
  37.  #ifdef THREADS
  38.     if (threads > 1)
  39.         pthread_mutex_unlock(&enqueue_mutex);
  40.  #endif /* THREADS */
  41. -   if (!keepgoing)
  42. -       return(NULL);
  43.  
  44.     /* process it */
  45.     rl = rev_list_file(filename, &out);
  46.  
  47. -   /* pass it to the next stage */
  48. +   /* accumulate data */
  49. +   *local_tail = rl;
  50. +   total_revisions += out.total_revisions;
  51. +   if (out.skew_vulnerable > local_skew_vulnerable)
  52. +       local_skew_vulnerable = out.skew_vulnerable;
  53. +   local_tail = &rl->next;
  54. +    }
  55. +
  56.  #ifdef THREADS
  57. -   if (threads > 1)
  58. -       pthread_mutex_lock(&revlist_mutex);
  59. +    if (threads > 1)
  60. +    {
  61. +   pthread_mutex_unlock(&enqueue_mutex);
  62. +   pthread_mutex_lock(&revlist_mutex);
  63. +    }
  64.  #endif /* THREADS */
  65. -   progress_jump(++load_current_file);
  66. -   *tail = rl;
  67. -   total_revisions += out.total_revisions;
  68. -   if (out.skew_vulnerable > skew_vulnerable)
  69. -       skew_vulnerable = out.skew_vulnerable;
  70. -   tail = (volatile rev_list **)&rl->next;
  71. +    /* pass it to the next stage */
  72. +    progress_jump(++load_current_file);
  73. +    *tail = local_head;
  74. +    tail = (volatile rev_list**)local_tail;
  75. +    total_revisions += local_total_revisions;
  76. +    if (local_skew_vulnerable > skew_vulnerable)
  77. +        skew_vulnerable = local_skew_vulnerable;
  78.  #ifdef THREADS
  79. -   if (threads > 1)
  80. -       pthread_mutex_unlock(&revlist_mutex);
  81. +    if (threads > 1)
  82. +   pthread_mutex_unlock(&revlist_mutex);
  83.  #endif /* THREADS */
  84. -    }
  85. +    return(NULL);
  86.  }
  87.  
  88.  rev_list *analyze_masters(int argc, char *argv[],
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement