ATLAS Offline Software
StreamHolder.cxx
Go to the documentation of this file.
1 //
2 // Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3 //
4 
5 // Local include(s).
8 
9 namespace AthCUDA {
10 
12  : m_stream( nullptr ), m_pool( nullptr ) {
13 
14  }
15 
17  : m_stream( stream ), m_pool( pool ) {
18 
19  }
20 
22  : m_stream( parent.m_stream ), m_pool( parent.m_pool ) {
23 
24  parent.m_stream = nullptr;
25  parent.m_pool = nullptr;
26  }
27 
29 
30  if( ( m_stream != nullptr ) && ( m_pool != nullptr ) ) {
31  m_pool->yieldStream( *this );
32  }
33  }
34 
36 
37  // Check if anything needs to be done.
38  if( this == &rhs ) {
39  return *this;
40  }
41 
42  // Perform the move.
43  m_stream = rhs.m_stream;
44  rhs.m_stream = nullptr;
45  m_pool = rhs.m_pool;
46  rhs.m_pool = nullptr;
47  return *this;
48  }
49 
50  StreamHolder::operator bool() const {
51 
52  return ( m_stream != nullptr );
53  }
54 
55 } // namespace AthCUDA
AthCUDA::IStreamPoolSvc
Interface for a CUDA stream pool service.
Definition: IStreamPoolSvc.h:24
AthCUDA::StreamHolder::m_stream
void * m_stream
The managed stream.
Definition: StreamHolder.h:53
pool
pool namespace
Definition: libname.h:15
AthenaPoolTestWrite.stream
string stream
Definition: AthenaPoolTestWrite.py:12
AthCUDA::StreamHolder::m_pool
IStreamPoolSvc * m_pool
The pool that this holder is attached to.
Definition: StreamHolder.h:55
AthCUDA
Definition: Info.h:14
test_pyathena.parent
parent
Definition: test_pyathena.py:15
IStreamPoolSvc.h
AthCUDA::StreamHolder::operator=
StreamHolder & operator=(const StreamHolder &)=delete
Copy assignment operator.
StreamHolder.h
AthCUDA::StreamHolder
Helper class for handling CUDA streams.
Definition: StreamHolder.h:24
AthCUDA::StreamHolder::StreamHolder
StreamHolder()
Friend declaration(s).
Definition: StreamHolder.cxx:11
xAOD::bool
setBGCode setTAP setLVL2ErrorBits bool
Definition: TrigDecision_v1.cxx:60
AthCUDA::StreamHolder::~StreamHolder
~StreamHolder()
Destructor.
Definition: StreamHolder.cxx:28
AthCUDA::IStreamPoolSvc::yieldStream
virtual void yieldStream(StreamHolder &stream)=0
Put a given stream back into the pool.