Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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
19namespace RooFit {
20namespace MultiProcess {
21
22class Queue {
23public:
24 virtual ~Queue() = default;
25
26 /// Have a worker ask for a task-message from the queue
27 ///
28 /// \param[out] job_task JobTask reference to put the Job ID and the task index into.
29 /// \return true if a task was popped from the queue successfully, false if the queue was empty.
30 virtual bool pop(JobTask &job_task) = 0;
31
32 /// Enqueue a task
33 ///
34 /// \param[in] job_task JobTask object that contains the Job ID and the task index.
35 virtual void add(JobTask job_task) = 0;
36
37 void loop();
38
39 void process_master_message(M2Q message);
40 void process_worker_message(std::size_t this_worker_id, W2Q message);
41
42protected:
43 std::size_t N_tasks_ = 0; // total number of received tasks
44 std::size_t N_tasks_at_workers_ = 0;
45};
46
47} // namespace MultiProcess
48} // namespace RooFit
49
50#endif // ROOT_ROOFIT_MultiProcess_Queue
Keeps a queue of tasks for workers and manages the queue process through its event loop.
Definition Queue.h:22
virtual bool pop(JobTask &job_task)=0
Have a worker ask for a task-message from the queue.
void loop()
The queue process's event loop.
Definition Queue.cxx:83
virtual void add(JobTask job_task)=0
Enqueue a task.
void process_master_message(M2Q message)
Helper function for 'Queue::loop()'.
Definition Queue.cxx:43
virtual ~Queue()=default
std::size_t N_tasks_at_workers_
Definition Queue.h:44
void process_worker_message(std::size_t this_worker_id, W2Q message)
Helper function for 'Queue::loop()'.
Definition Queue.cxx:60
The namespace RooFit contains mostly switches that change the behaviour of functions of PDFs (or othe...
Definition CodegenImpl.h:64
combined job_object, state and task identifier type
Definition types.h:25