Team Fortress 2 Source Code as on 22/4/2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

42 lines
1.3 KiB

  1. //====== Copyright (c), Valve Corporation, All rights reserved. =======
  2. //
  3. // Purpose: Implements singleton datacache with support for yielding updates
  4. //
  5. //=============================================================================
  6. #ifndef GCPARALLELJOBFARM_H
  7. #define GCPARALLELJOBFARM_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. namespace GCSDK
  12. {
  13. class IYieldingParallelFarmJobHandler
  14. {
  15. //
  16. // Derived class instances implementing farm job workload processing must
  17. // be allocated on the heap as the calling job will yield for processing.
  18. //
  19. protected:
  20. //
  21. // BYieldingRunWorkload is called on different newly created farm jobs
  22. // Param passed iJobSequenceCounter starts at 0 (zero) for the first framed job
  23. // and is incremented by one for each subsequently farmed job.
  24. // When the parallel processing should end job must set pbWorkloadCompleted to true
  25. // and return true as success.
  26. // Any farmed job returning false will abort further farmed processing and
  27. // will result in BYieldingExecuteParallel returning false to the caller job.
  28. //
  29. virtual bool BYieldingRunWorkload( int iJobSequenceCounter, bool *pbWorkloadCompleted ) = 0;
  30. public:
  31. bool BYieldingExecuteParallel( int numJobsParallel, char const *pchJobName = NULL, uint nTimeoutSec = 0 );
  32. };
  33. } // namespace GCSDK
  34. #endif // GCPARALLELJOBFARM_H