mirror of
				https://github.com/SoftFever/OrcaSlicer.git
				synced 2025-10-30 20:21:12 -06:00 
			
		
		
		
	Add max_concurrency method for various execution policies
This commit is contained in:
		
							parent
							
								
									e3c2e513fa
								
							
						
					
					
						commit
						b8c1c13666
					
				
					 1 changed files with 9 additions and 1 deletions
				
			
		|  | @ -5,6 +5,7 @@ | |||
| #include <tbb/mutex.h> | ||||
| #include <tbb/parallel_for.h> | ||||
| #include <tbb/parallel_reduce.h> | ||||
| #include <tbb/task_arena.h> | ||||
| 
 | ||||
| #include <algorithm> | ||||
| #include <numeric> | ||||
|  | @ -76,13 +77,18 @@ template<> struct _ccr<true> | |||
|             from, to, init, std::forward<MergeFn>(mergefn), | ||||
|             [](typename I::value_type &i) { return i; }, granularity); | ||||
|     } | ||||
| 
 | ||||
|     static size_t max_concurreny() | ||||
|     { | ||||
|         return tbb::this_task_arena::max_concurrency(); | ||||
|     } | ||||
| }; | ||||
| 
 | ||||
| template<> struct _ccr<false> | ||||
| { | ||||
| private: | ||||
|     struct _Mtx { inline void lock() {} inline void unlock() {} }; | ||||
|      | ||||
| 
 | ||||
| public: | ||||
|     using SpinningMutex = _Mtx; | ||||
|     using BlockingMutex = _Mtx; | ||||
|  | @ -133,6 +139,8 @@ public: | |||
|         return reduce(from, to, init, std::forward<MergeFn>(mergefn), | ||||
|                       [](typename I::value_type &i) { return i; }); | ||||
|     } | ||||
| 
 | ||||
|     static size_t max_concurreny() { return 1; } | ||||
| }; | ||||
| 
 | ||||
| using ccr = _ccr<USE_FULL_CONCURRENCY>; | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 tamasmeszaros
						tamasmeszaros