mirror of
				https://github.com/VCMP-SqMod/SqMod.git
				synced 2025-11-04 00:07:19 +01:00 
			
		
		
		
	Update ThreadPool.hpp
This commit is contained in:
		@@ -171,7 +171,7 @@ public:
 | 
				
			|||||||
    void Process();
 | 
					    void Process();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /* --------------------------------------------------------------------------------------------
 | 
					    /* --------------------------------------------------------------------------------------------
 | 
				
			||||||
     * Queue an item to be processed.
 | 
					     * Queue an item to be processed. Will take ownership of the given pointer!
 | 
				
			||||||
    */
 | 
					    */
 | 
				
			||||||
    void Enqueue(ThreadPoolItem * item)
 | 
					    void Enqueue(ThreadPoolItem * item)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
@@ -191,16 +191,18 @@ public:
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
        else
 | 
					        else
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
 | 
					            // Take ownership
 | 
				
			||||||
 | 
					            Item i{item};
 | 
				
			||||||
            // Perform the task in-place
 | 
					            // Perform the task in-place
 | 
				
			||||||
            if (item->OnPrepare())
 | 
					            if (i->OnPrepare())
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                if (item->OnProcess())
 | 
					                if (i->OnProcess())
 | 
				
			||||||
                {
 | 
					                {
 | 
				
			||||||
                    item->OnAborted(true); // Not accepted in single thread
 | 
					                    i->OnAborted(true); // Not accepted in single thread
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            // Item was finished in main thread
 | 
					            // Task is completed in processing stage
 | 
				
			||||||
            item->OnCompleted();
 | 
					            m_Finished.enqueue(std::move(i));
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user