LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
art::ScheduleContext Class Reference

#include "ScheduleContext.h"

Public Member Functions

 ScheduleContext () noexcept=default
 
ScheduleID currentScheduleID () const
 
friend int::main ()
 

Private Types

using flag_type = unsigned char
 

Private Member Functions

bool setContext ()
 
bool resetContext ()
 

Private Attributes

std::atomic< flag_typein_context_ {false}
 

Friends

class detail::ScheduleContextSetter
 

Detailed Description

Definition at line 19 of file ScheduleContext.h.

Member Typedef Documentation

using art::ScheduleContext::flag_type = unsigned char
private

Definition at line 31 of file ScheduleContext.h.

Constructor & Destructor Documentation

art::ScheduleContext::ScheduleContext ( )
explicitdefaultnoexcept

Member Function Documentation

art::ScheduleID art::ScheduleContext::currentScheduleID ( ) const

Definition at line 10 of file ScheduleContext_service.cc.

References in_context_.

11 {
12  if (!in_context_.load()) {
13  return ScheduleID{};
14  } // Not in schedule-running context.
15  tbb::task* ct = &tbb::task::self();
16  detail::ScheduleTask* st{nullptr};
17  while (ct != nullptr &&
18  (st = dynamic_cast<detail::ScheduleTask*>(ct)) == nullptr) {
19  ct = ct->parent();
20  }
21  return (st ? st->scheduleID() : ScheduleID());
22 }
std::atomic< flag_type > in_context_
bool art::ScheduleContext::resetContext ( )
inlineprivate

Definition at line 42 of file ScheduleContext.h.

References DECLARE_ART_SYSTEM_SERVICE, and art::GLOBAL.

43 {
44  return in_context_.fetch_and(false);
45 }
std::atomic< flag_type > in_context_
bool art::ScheduleContext::setContext ( )
inlineprivate

Definition at line 36 of file ScheduleContext.h.

37 {
38  return in_context_.fetch_or(true);
39 }
std::atomic< flag_type > in_context_

Friends And Related Function Documentation

friend class detail::ScheduleContextSetter
friend

Definition at line 24 of file ScheduleContext.h.

Member Data Documentation

std::atomic<flag_type> art::ScheduleContext::in_context_ {false}
private

Definition at line 32 of file ScheduleContext.h.

Referenced by currentScheduleID().


The documentation for this class was generated from the following files: