Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
FIFOQueue.cxx
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) 2022, 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
16#include "FIFOQueue.h"
17
18namespace RooFit {
19namespace MultiProcess {
20
21/** \class FIFOQueue
22 * \brief A Queue with simple FIFO behavior
23 */
24
25/// See Queue::pop.
26bool FIFOQueue::pop(JobTask &job_task)
27{
28 if (queue_.empty()) {
29 return false;
30 } else {
31 job_task = queue_.front();
32 queue_.pop();
33 return true;
34 }
35}
36
37/// See Queue::add.
38void FIFOQueue::add(JobTask job_task)
39{
40 if (JobManager::instance()->process_manager().is_master()) {
42 job_task.task_id);
43 } else if (JobManager::instance()->process_manager().is_queue()) {
44 queue_.push(job_task);
45 } else {
46 throw std::logic_error("calling Communicator::to_master_queue from slave process");
47 }
48}
49
50} // namespace MultiProcess
51} // namespace RooFit
void add(JobTask job_task) override
See Queue::add.
Definition FIFOQueue.cxx:38
std::queue< JobTask > queue_
Definition FIFOQueue.h:28
bool pop(JobTask &job_task) override
See Queue::pop.
Definition FIFOQueue.cxx:26
static JobManager * instance()
The namespace RooFit contains mostly switches that change the behaviour of functions of PDFs (or othe...
Definition JSONIO.h:26
combined job_object, state and task identifier type
Definition types.h:25