Problem Statement: Task Scheduler with Buffered Execution
You are tasked with designing a system, named TaskProcessor, that efficiently handles a stream of tasks. The system should ensure that when a certain number of tasks accumulate (e.g., a batch of 10), they are processed or flushed for execution. It should also have mechanisms to deal with large influxes of tasks and ensure smooth processing.
class TaskProcessor {
public:
TaskProcessor();
// Adds a new task to the processor
void runTask(std::function<void()> task);
// Processes accumulated tasks
void flushTasks();
};