CMS 3D CMS Logo

List of all members | Classes | Public Member Functions | Private Attributes
edm::ThreadSafeAddOnlyContainer< T > Class Template Reference

#include <ThreadSafeAddOnlyContainer.h>

Classes

class  Node
 

Public Member Functions

template<typename... Args>
TmakeAndHold (Args &&... args)
 
 ThreadSafeAddOnlyContainer ()
 
 ~ThreadSafeAddOnlyContainer ()
 

Private Attributes

std::atomic< Node * > front_
 

Detailed Description

template<typename T>
class edm::ThreadSafeAddOnlyContainer< T >

Definition at line 31 of file ThreadSafeAddOnlyContainer.h.

Constructor & Destructor Documentation

◆ ThreadSafeAddOnlyContainer()

Definition at line 58 of file ThreadSafeAddOnlyContainer.h.

58 : front_(nullptr) {}

◆ ~ThreadSafeAddOnlyContainer()

Definition at line 61 of file ThreadSafeAddOnlyContainer.h.

61  {
62  Node const* node = front_.load();
63  while (node) {
64  Node const* next = node->next();
65  delete node;
66  node = next;
67  }
68  }

References GetRecoTauVFromDQM_MC_cff::next, and edm::ThreadSafeAddOnlyContainer< T >::Node::next().

Member Function Documentation

◆ makeAndHold()

template<typename T >
template<typename... Args>
T * edm::ThreadSafeAddOnlyContainer< T >::makeAndHold ( Args &&...  args)

Definition at line 72 of file ThreadSafeAddOnlyContainer.h.

72  {
73  Node* expected = front_.load();
74  Node* newNode = new Node(expected, std::forward<Args>(args)...);
75  while (!front_.compare_exchange_strong(expected, newNode)) {
76  // another thread changed front_ before us so try again
77  newNode->setNext(expected);
78  }
79  return newNode->address();
80  }

References edm::ThreadSafeAddOnlyContainer< T >::Node::address(), writedatasetfile::args, and edm::ThreadSafeAddOnlyContainer< T >::Node::setNext().

Member Data Documentation

◆ front_

template<typename T >
std::atomic<Node*> edm::ThreadSafeAddOnlyContainer< T >::front_
private

Definition at line 54 of file ThreadSafeAddOnlyContainer.h.

writedatasetfile.args
args
Definition: writedatasetfile.py:18
edm::ThreadSafeAddOnlyContainer::front_
std::atomic< Node * > front_
Definition: ThreadSafeAddOnlyContainer.h:54
cms::Node
TGeoNode Node
Definition: DDFilteredView.h:50
GetRecoTauVFromDQM_MC_cff.next
next
Definition: GetRecoTauVFromDQM_MC_cff.py:31