void ThreadFunction( TaskQueue& tasks ) { while( !tasks.IsEmpty() ) { { auto task = tasks.PullTask(); // Process this task. task(); }; }; };