VirtualBox

Changeset 1801 in kBuild for trunk/src/kmk


Ignore:
Timestamp:
Sep 21, 2008 2:29:24 PM (16 years ago)
Author:
bird
Message:

incdep: make thread count relative to the job slots.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kmk/incdep.c

    r1800 r1801  
    130130/* The handles to the worker threads. */
    131131#ifdef HAVE_PTHREAD
    132 static pthread_t incdep_threads[1];
     132static pthread_t incdep_threads[4];
    133133#elif defined (WINDOWS32)
    134 static HANDLE incdep_threads[1];
     134static HANDLE incdep_threads[4];
    135135#elif defined (__OS2__)
    136 static TID incdep_threads[1];
    137 #endif
     136static TID incdep_threads[4];
     137#endif
     138static unsigned incdep_num_threads = 1;
    138139
    139140/* flag indicating whether the worker threads should terminate or not. */
     
    431432
    432433  incdep_terminate = 0;
    433   for (i = 0; i < sizeof (incdep_threads) / sizeof (incdep_threads[0]); i++)
     434  incdep_num_threads = sizeof (incdep_threads) / sizeof (incdep_threads[0]);
     435  if (incdep_num_threads + 1 > job_slots)
     436    incdep_num_threads = job_slots <= 1 ? 1 : job_slots - 1;
     437  for (i = 0; i < incdep_num_threads; i++)
    434438    {
    435439#ifdef HAVE_PTHREAD
     
    489493  /* wait for the threads to quit */
    490494
    491   for (i = 0; i < sizeof (incdep_threads) / sizeof (incdep_threads[0]); i++)
     495  for (i = 0; i < incdep_num_threads; i++)
    492496    {
    493497      /* later? */
    494498    }
     499  incdep_num_threads = 0;
    495500
    496501  /* destroy the lock and condition variables / event objects. */
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette