IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 20834


Ignore:
Timestamp:
Nov 25, 2008, 3:22:30 PM (17 years ago)
Author:
Paul Price
Message:

Ensure all jobs are harvested before returning.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/sys/psThread.c

    r19297 r20834  
    254254}
    255255
     256// Harvest jobs from the
     257static void psThreadJobHarvest(void)
     258{
     259    psThreadLock();
     260    psThreadJob *job;           // Job from done queue
     261    while ((job = psThreadJobGetDone())) {
     262        psFree(job);
     263    }
     264    psThreadUnlock();
     265    return;
     266}
     267
    256268// call this function after you have added jobs to the queue and
    257269bool psThreadPoolWait(bool harvest)
     
    273285        // Harvest jobs, if requested
    274286        if (harvest) {
    275             psThreadLock();
    276             psThreadJob *job;           // Job from done queue
    277             while ((job = psThreadJobGetDone())) {
    278                 psFree(job);
    279             }
    280             psThreadUnlock();
     287            psThreadJobHarvest();
    281288        }
    282289
     
    294301            // Nothing in the queue
    295302            psThreadUnlock();
     303            // Ensure everything is harvested, if requested
     304            if (harvest) {
     305                psThreadJobHarvest();
     306            }
    296307            return true;
    297308        }
Note: See TracChangeset for help on using the changeset viewer.