Logo ROOT  
Reference Guide
Queue.h
Go to the documentation of this file.
1/*
2 * Project: RooFit
3 * Authors:
4 * PB, Patrick Bos, Netherlands eScience Center, p.bos@esciencecenter.nl
5 * IP, Inti Pelupessy, Netherlands eScience Center, i.pelupessy@esciencecenter.nl
6 *
7 * Copyright (c) 2021, CERN
8 *
9 * Redistribution and use in source and binary forms,
10 * with or without modification, are permitted according to the terms
11 * listed in LICENSE (http://roofit.sourceforge.net/license.txt)
12 */
13#ifndef ROOT_ROOFIT_MultiProcess_Queue
14#define ROOT_ROOFIT_MultiProcess_Queue
15
18
19#include <queue>
20
21namespace RooFit {
22namespace MultiProcess {
23
24class Queue {
25public:
26 bool pop(JobTask &job_task);
27 void add(JobTask job_task);
28
29 void loop();
30
31 void process_master_message(M2Q message);
32 void process_worker_message(std::size_t this_worker_id, W2Q message);
33
34private:
35 std::queue<JobTask> queue_;
36 std::size_t N_tasks_ = 0; // total number of received tasks
37 std::size_t N_tasks_at_workers_ = 0;
38};
39
40} // namespace MultiProcess
41} // namespace RooFit
42
43#endif // ROOT_ROOFIT_MultiProcess_Queue
Keeps a queue of tasks for workers and manages the queue process through its event loop.
Definition: Queue.h:24
void loop()
The queue process's event loop.
Definition: Queue.cxx:114
std::size_t N_tasks_
Definition: Queue.h:36
void add(JobTask job_task)
Enqueue a task.
Definition: Queue.cxx:61
void process_master_message(M2Q message)
Helper function for 'Queue::loop()'.
Definition: Queue.cxx:74
bool pop(JobTask &job_task)
Have a worker ask for a task-message from the queue.
Definition: Queue.cxx:47
std::size_t N_tasks_at_workers_
Definition: Queue.h:37
void process_worker_message(std::size_t this_worker_id, W2Q message)
Helper function for 'Queue::loop()'.
Definition: Queue.cxx:91
std::queue< JobTask > queue_
Definition: Queue.h:35
The namespace RooFit contains mostly switches that change the behaviour of functions of PDFs (or othe...
Definition: Common.h:18
combined job_object, state and task identifier type
Definition: types.h:25