Class QueryDispatchQueue

class QueryDispatchQueue

QueryDispatchQueue maintains a list of pending queries and dispatches those queries as Executors become available

Public Types

using Task = std::packaged_task<void(size_t)>

Public Functions

QueryDispatchQueue(const size_t parallel_executors_max)
void submit(std::shared_ptr<Task> task, const bool is_update_delete)

Submit a new task to the queue. Blocks until the task begins execution. The caller is expected to maintain a copy of the shared_ptr which will be used to access results once the task runs.

bool hasIdleWorker()
~QueryDispatchQueue()

Private Functions

void worker(const size_t worker_idx)

Private Members

std::mutex queue_mutex_
std::condition_variable cv_
std::mutex update_delete_mutex_
bool threads_should_exit_ QueryDispatchQueue::false
std::queue<std::shared_ptr<Task>> queue_
std::vector<std::thread> workers_
int num_running_workers_
int num_workers_