Geant4  v4-10.4-release
 모두 클래스 네임스페이스들 파일들 함수 변수 타입정의 열거형 타입 열거형 멤버 Friends 매크로 그룹들 페이지들
Public 타입 | Public 멤버 함수 | Private 멤버 함수 | 모든 멤버 목록
G4TemplateAutoLock< _Mutex_t > 클래스 템플릿 참조

#include <G4AutoLock.hh>

G4TemplateAutoLock< _Mutex_t >에 대한 상속 다이어그램 :

Public 타입

typedef std::unique_lock
< _Mutex_t > 
unique_lock_t
 
typedef G4TemplateAutoLock
< _Mutex_t > 
this_type
 
typedef unique_lock_t::mutex_type mutex_type
 

Public 멤버 함수

 G4TemplateAutoLock (mutex_type &_mutex)
 
template<typename Rep , typename Period >
 G4TemplateAutoLock (mutex_type &_mutex, const std::chrono::duration< Rep, Period > &_timeout_duration)
 
template<typename Clock , typename Duration >
 G4TemplateAutoLock (mutex_type &_mutex, const std::chrono::time_point< Clock, Duration > &_timeout_time)
 
 G4TemplateAutoLock (mutex_type &_mutex, std::defer_lock_t _lock) noexcept
 
 G4TemplateAutoLock (mutex_type &_mutex, std::try_to_lock_t)
 
 G4TemplateAutoLock (mutex_type &_mutex, std::adopt_lock_t)
 
 G4TemplateAutoLock (mutex_type *_mutex)
 
 G4TemplateAutoLock (mutex_type *_mutex, std::defer_lock_t _lock) noexcept
 
 G4TemplateAutoLock (mutex_type *_mutex, std::try_to_lock_t)
 
 G4TemplateAutoLock (mutex_type *_mutex, std::adopt_lock_t)
 
void lock ()
 
void unlock ()
 
bool try_lock ()
 
template<typename Rep , typename Period >
bool try_lock_for (const std::chrono::duration< Rep, Period > &)
 
template<typename Clock , typename Duration >
bool try_lock_until (const std::chrono::time_point< Clock, Duration > &)
 
void swap (this_type &other) noexcept
 
bool owns_lock () const noexcept
 

Private 멤버 함수

template<typename _Tp = _Mutex_t, typename std::enable_if< _is_stand_mutex(_Tp), int >::type = 0>
std::string GetTypeString ()
 
template<typename _Tp = _Mutex_t, typename std::enable_if< _is_recur_mutex(_Tp), int >::type = 0>
std::string GetTypeString ()
 
template<typename _Tp = _Mutex_t, typename std::enable_if< _is_other_mutex(_Tp), int >::type = 0>
std::string GetTypeString ()
 
template<typename _Tp >
void suppress_unused_variable (const _Tp &)
 
void _lock_deferred ()
 
template<typename Rep , typename Period >
void _lock_deferred (const std::chrono::duration< Rep, Period > &_timeout_duration)
 
template<typename Clock , typename Duration >
void _lock_deferred (const std::chrono::time_point< Clock, Duration > &_timeout_time)
 
void PrintLockErrorMessage (std::system_error &e)
 

상세한 설명

template<typename _Mutex_t>
class G4TemplateAutoLock< _Mutex_t >

============================================================================//

void print_threading() { #ifdef G4MULTITHREADED std::cout << "\nUsing G4MULTITHREADED version..." << std::endl; else std::cout << "\nUsing G4SERIAL version..." << std::endl; #endif }

============================================================================//

typedef std::unique_lock<std::mutex> unique_lock_t; functions for casting G4AutoLock to std::unique_lock to demonstrate that G4AutoLock is NOT polymorphic void as_unique_lock(unique_lock_t* lock) { lock->lock(); } void as_unique_unlock(unique_lock_t* lock) { lock->unlock(); }

============================================================================//

void run(const uint64_t& n) { sync the threads a bit std::this_thread::sleep_for(std::chrono::milliseconds(10));

get two mutexes to avoid deadlock when l32 actually locks G4AutoLock l32(G4TypeMutex<int32_t>(), std::defer_lock); G4AutoLock l64(G4TypeMutex<int64_t>(), std::defer_lock);

when serial: will not execute std::unique_lock::lock() because it overrides the member function l32.lock(); regardless of serial or MT: will execute std::unique_lock::lock() because std::unique_lock::lock() is not virtual as_unique_lock(&l64);

std::cout << "Running iteration " << n << "..." << std::endl; }

============================================================================// execute some work template <typename thread_type="std::thread"> void exec(uint64_t n) { get two mutexes to avoid deadlock when l32 actually locks G4AutoLock l32(G4TypeMutex<int32_t>(), std::defer_lock); G4AutoLock l64(G4TypeMutex<int64_t>(), std::defer_lock);

std::vector<thread_type*> threads(n, nullptr); for(uint64_t i = 0; i < n; ++i) { threads[i] = new thread_type(); (threads[i]) = std::move(thread_type(run, i)); }

when serial: will not execute std::unique_lock::lock() because it overrides the member function l32.lock(); regardless of serial or MT: will execute std::unique_lock::lock() because std::unique_lock::lock() is not virtual as_unique_lock(&l64);

std::cout << "Joining..." << std::endl;

when serial: will not execute std::unique_lock::unlock() because it overrides the member function l32.unlock(); regardless of serial or MT: will execute std::unique_lock::unlock() because std::unique_lock::unlock() is not virtual as_unique_unlock(&l64);

NOTE ABOUT UNLOCKS: in MT, commenting out either l32.unlock(); or as_unique_unlock(&l64); creates a deadlock; in serial, commenting out as_unique_unlock(&l64); creates a deadlock but commenting out l32.unlock(); does not

clean up and join for(uint64_t i = 0; i < n; ++i) { threads[i]->join(); delete threads[i]; } threads.clear(); }

============================================================================//

int main() { print_threading();

uint64_t n = 30; std::cout << "\nRunning with real threads...\n" << std::endl; exec<std::thread>(n); std::cout << "\nRunning with fake threads...\n" << std::endl; exec<G4DummyThread>(n);

}

G4AutoLock.hh 파일의 276 번째 라인에서 정의되었습니다.

멤버 타입정의 문서화

template<typename _Mutex_t >
typedef unique_lock_t::mutex_type G4TemplateAutoLock< _Mutex_t >::mutex_type

G4AutoLock.hh 파일의 284 번째 라인에서 정의되었습니다.

template<typename _Mutex_t >
typedef G4TemplateAutoLock<_Mutex_t> G4TemplateAutoLock< _Mutex_t >::this_type

G4AutoLock.hh 파일의 283 번째 라인에서 정의되었습니다.

template<typename _Mutex_t >
typedef std::unique_lock<_Mutex_t> G4TemplateAutoLock< _Mutex_t >::unique_lock_t

G4AutoLock.hh 파일의 282 번째 라인에서 정의되었습니다.

생성자 & 소멸자 문서화

template<typename _Mutex_t >
G4TemplateAutoLock< _Mutex_t >::G4TemplateAutoLock ( mutex_type _mutex)
inline

G4AutoLock.hh 파일의 295 번째 라인에서 정의되었습니다.

다음을 참조함 : G4TemplateAutoLock< _Mutex_t >::_lock_deferred().

template<typename _Mutex_t >
template<typename Rep , typename Period >
G4TemplateAutoLock< _Mutex_t >::G4TemplateAutoLock ( mutex_type _mutex,
const std::chrono::duration< Rep, Period > &  _timeout_duration 
)
inline

G4AutoLock.hh 파일의 307 번째 라인에서 정의되었습니다.

다음을 참조함 : G4TemplateAutoLock< _Mutex_t >::_lock_deferred().

template<typename _Mutex_t >
template<typename Clock , typename Duration >
G4TemplateAutoLock< _Mutex_t >::G4TemplateAutoLock ( mutex_type _mutex,
const std::chrono::time_point< Clock, Duration > &  _timeout_time 
)
inline

G4AutoLock.hh 파일의 321 번째 라인에서 정의되었습니다.

다음을 참조함 : G4TemplateAutoLock< _Mutex_t >::_lock_deferred().

template<typename _Mutex_t >
G4TemplateAutoLock< _Mutex_t >::G4TemplateAutoLock ( mutex_type _mutex,
std::defer_lock_t  _lock 
)
inlinenoexcept

G4AutoLock.hh 파일의 331 번째 라인에서 정의되었습니다.

template<typename _Mutex_t >
G4TemplateAutoLock< _Mutex_t >::G4TemplateAutoLock ( mutex_type _mutex,
std::try_to_lock_t   
)
inline

G4AutoLock.hh 파일의 352 번째 라인에서 정의되었습니다.

template<typename _Mutex_t >
G4TemplateAutoLock< _Mutex_t >::G4TemplateAutoLock ( mutex_type _mutex,
std::adopt_lock_t   
)
inline

G4AutoLock.hh 파일의 357 번째 라인에서 정의되었습니다.

template<typename _Mutex_t >
G4TemplateAutoLock< _Mutex_t >::G4TemplateAutoLock ( mutex_type _mutex)
inline

G4AutoLock.hh 파일의 367 번째 라인에서 정의되었습니다.

다음을 참조함 : G4TemplateAutoLock< _Mutex_t >::_lock_deferred().

template<typename _Mutex_t >
G4TemplateAutoLock< _Mutex_t >::G4TemplateAutoLock ( mutex_type _mutex,
std::defer_lock_t  _lock 
)
inlinenoexcept

G4AutoLock.hh 파일의 374 번째 라인에서 정의되었습니다.

template<typename _Mutex_t >
G4TemplateAutoLock< _Mutex_t >::G4TemplateAutoLock ( mutex_type _mutex,
std::try_to_lock_t   
)
inline

G4AutoLock.hh 파일의 390 번째 라인에서 정의되었습니다.

template<typename _Mutex_t >
G4TemplateAutoLock< _Mutex_t >::G4TemplateAutoLock ( mutex_type _mutex,
std::adopt_lock_t   
)
inline

G4AutoLock.hh 파일의 394 번째 라인에서 정의되었습니다.

멤버 함수 문서화

template<typename _Mutex_t >
void G4TemplateAutoLock< _Mutex_t >::_lock_deferred ( )
inlineprivate

G4AutoLock.hh 파일의 483 번째 라인에서 정의되었습니다.

다음을 참조함 : e, G4TemplateAutoLock< _Mutex_t >::PrintLockErrorMessage().

다음에 의해서 참조됨 : G4TemplateAutoLock< _Mutex_t >::G4TemplateAutoLock().

template<typename _Mutex_t >
template<typename Rep , typename Period >
void G4TemplateAutoLock< _Mutex_t >::_lock_deferred ( const std::chrono::duration< Rep, Period > &  _timeout_duration)
inlineprivate
template<typename _Mutex_t >
template<typename Clock , typename Duration >
void G4TemplateAutoLock< _Mutex_t >::_lock_deferred ( const std::chrono::time_point< Clock, Duration > &  _timeout_time)
inlineprivate
template<typename _Mutex_t >
template<typename _Tp = _Mutex_t, typename std::enable_if< _is_stand_mutex(_Tp), int >::type = 0>
std::string G4TemplateAutoLock< _Mutex_t >::GetTypeString ( )
inlineprivate

G4AutoLock.hh 파일의 444 번째 라인에서 정의되었습니다.

template<typename _Mutex_t >
template<typename _Tp = _Mutex_t, typename std::enable_if< _is_recur_mutex(_Tp), int >::type = 0>
std::string G4TemplateAutoLock< _Mutex_t >::GetTypeString ( )
inlineprivate

G4AutoLock.hh 파일의 448 번째 라인에서 정의되었습니다.

template<typename _Mutex_t >
template<typename _Tp = _Mutex_t, typename std::enable_if< _is_other_mutex(_Tp), int >::type = 0>
std::string G4TemplateAutoLock< _Mutex_t >::GetTypeString ( )
inlineprivate

G4AutoLock.hh 파일의 452 번째 라인에서 정의되었습니다.

template<typename _Mutex_t >
void G4TemplateAutoLock< _Mutex_t >::lock ( )
inline
template<typename _Mutex_t >
bool G4TemplateAutoLock< _Mutex_t >::owns_lock ( ) const
inlinenoexcept

G4AutoLock.hh 파일의 426 번째 라인에서 정의되었습니다.

template<typename _Mutex_t >
void G4TemplateAutoLock< _Mutex_t >::PrintLockErrorMessage ( std::system_error &  e)
inlineprivate

G4AutoLock.hh 파일의 528 번째 라인에서 정의되었습니다.

다음을 참조함 : G4TemplateAutoLock< _Mutex_t >::suppress_unused_variable().

다음에 의해서 참조됨 : G4TemplateAutoLock< _Mutex_t >::_lock_deferred().

template<typename _Mutex_t >
template<typename _Tp >
void G4TemplateAutoLock< _Mutex_t >::suppress_unused_variable ( const _Tp &  )
inlineprivate

G4AutoLock.hh 파일의 461 번째 라인에서 정의되었습니다.

다음에 의해서 참조됨 : G4TemplateAutoLock< _Mutex_t >::_lock_deferred(), G4TemplateAutoLock< _Mutex_t >::PrintLockErrorMessage().

template<typename _Mutex_t >
void G4TemplateAutoLock< _Mutex_t >::swap ( this_type other)
inlinenoexcept

G4AutoLock.hh 파일의 425 번째 라인에서 정의되었습니다.

template<typename _Mutex_t >
bool G4TemplateAutoLock< _Mutex_t >::try_lock ( )
inline

G4AutoLock.hh 파일의 415 번째 라인에서 정의되었습니다.

template<typename _Mutex_t >
template<typename Rep , typename Period >
bool G4TemplateAutoLock< _Mutex_t >::try_lock_for ( const std::chrono::duration< Rep, Period > &  )
inline

G4AutoLock.hh 파일의 418 번째 라인에서 정의되었습니다.

template<typename _Mutex_t >
template<typename Clock , typename Duration >
bool G4TemplateAutoLock< _Mutex_t >::try_lock_until ( const std::chrono::time_point< Clock, Duration > &  )
inline

G4AutoLock.hh 파일의 422 번째 라인에서 정의되었습니다.

template<typename _Mutex_t >
void G4TemplateAutoLock< _Mutex_t >::unlock ( )
inline

G4AutoLock.hh 파일의 414 번째 라인에서 정의되었습니다.

다음에 의해서 참조됨 : G4RootPNtupleManager::AddNtupleRow(), G4VDecayChannel::CheckAndFillDaughters(), G4VDecayChannel::CheckAndFillParent(), G4GeometryWorkspace::CloneParameterisedSolids(), G4GeometryWorkspace::CloneReplicaSolid(), G4Hdf5AnalysisManager::CloseFileImpl(), G4PenelopeGammaConversionModel::ComputeCrossSectionPerAtom(), G4PenelopeRayleighModel::ComputeCrossSectionPerAtom(), G4PenelopePhotoElectricModel::ComputeCrossSectionPerAtom(), G4PenelopeIonisationModel::ComputeDEDXPerVolume(), G4ImportanceConfigurator::Configure(), G4WorkerRunManager::ConstructScoringWorlds(), G4VUPLSplitter< T >::CreateSubInstance(), G4PDefManager::CreateSubInstance(), G4PenelopeIonisationModel::CrossSectionPerVolume(), G4DNAChemistryManager::DeleteInstance(), G4MolecularConfiguration::DeleteManager(), G4ChipsKaonMinusElasticXS::G4ChipsKaonMinusElasticXS(), G4ChipsKaonPlusElasticXS::G4ChipsKaonPlusElasticXS(), G4ChipsKaonPlusInelasticXS::G4ChipsKaonPlusInelasticXS(), G4ElasticHadrNucleusHE::G4ElasticHadrNucleusHE(), G4MTRunManagerKernel::G4MTRunManagerKernel(), G4SPSEneDistribution::GenEpnHistEnergies(), G4SPSEneDistribution::GenerateBbodyEnergies(), G4SPSEneDistribution::GenerateCPowEnergies(), G4SPSAngDistribution::GenerateUserDefPhi(), G4SPSAngDistribution::GenerateUserDefTheta(), G4SPSEneDistribution::GenUserHistEnergies(), G4PenelopeBremsstrahlungModel::GetCrossSectionTableForCouple(), G4LatticeManager::GetLatticeManager(), G4MolecularConfiguration::GetManager(), G4CSGSolid::GetPolyhedron(), G4BooleanSolid::GetPolyhedron(), G4VCSGfaceted::GetPolyhedron(), G4EllipticalTube::GetPolyhedron(), G4VTwistedFaceted::GetPolyhedron(), G4Ellipsoid::GetPolyhedron(), G4Tet::GetPolyhedron(), G4TwistedTubs::GetPolyhedron(), G4Paraboloid::GetPolyhedron(), G4Hype::GetPolyhedron(), G4GenericTrap::GetPolyhedron(), G4MultiUnion::GetPolyhedron(), G4EllipticalCone::GetPolyhedron(), G4TessellatedSolid::GetPolyhedron(), HadrontherapyElectricTabulatedField3D::HadrontherapyElectricTabulatedField3D(), HadrontherapyMagneticField3D::HadrontherapyMagneticField3D(), G4BoldyshevTripletModel::InitialiseForElement(), G4LivermoreRayleighModel::InitialiseForElement(), G4LivermoreGammaConversionModelRC::InitialiseForElement(), G4LivermoreNuclearGammaConversionModel::InitialiseForElement(), G4LivermoreGammaConversionModel::InitialiseForElement(), G4LivermorePolarizedGammaConversionModel::InitialiseForElement(), G4LivermoreComptonModel::InitialiseForElement(), G4LivermorePolarizedRayleighModel::InitialiseForElement(), G4LivermorePolarizedComptonModel::InitialiseForElement(), G4LivermorePolarizedPhotoElectricGDModel::InitialiseForElement(), G4LivermoreBremsstrahlungModel::InitialiseForElement(), G4LivermorePolarizedPhotoElectricModel::InitialiseForElement(), G4LivermorePhotoElectricModel::InitialiseForElement(), G4LowEPComptonModel::InitialiseForElement(), G4LowEPPolarizedComptonModel::InitialiseForElement(), G4RunManagerKernel::InitializePhysics(), G4MolecularConfiguration::G4MolecularConfigurationManager::Insert(), G4DNAChemistryManager::Instance(), G4InuclNuclei::makeNuclearFragment(), G4ITTrackHolder::MasterInstance(), G4AccumulableManager::Merge(), G4RootPNtupleManager::Merge(), G4Hdf5AnalysisManager::OpenFileImpl(), PurgMagTabulatedField3D::PurgMagTabulatedField3D(), G4ITTrackHolder::PushToMaster(), RE05PrimaryGeneratorAction::RE05PrimaryGeneratorAction(), G4LatticeManager::RegisterLattice(), G4PenelopeGammaConversionModel::SampleSecondaries(), G4PenelopeRayleighModel::SampleSecondaries(), G4GeomSplitter< T >::SlaveCopySubInstanceArray(), G4MTRunManagerKernel::StartThread(), TabulatedField3D::TabulatedField3D(), mutex::unlock(), G4XmlAnalysisManager::WriteH1(), G4CsvAnalysisManager::WriteH1(), G4Hdf5AnalysisManager::WriteH1(), G4RootAnalysisManager::WriteH1(), G4XmlAnalysisManager::WriteH2(), G4CsvAnalysisManager::WriteH2(), G4Hdf5AnalysisManager::WriteH2(), G4RootAnalysisManager::WriteH2(), G4XmlAnalysisManager::WriteH3(), G4CsvAnalysisManager::WriteH3(), G4Hdf5AnalysisManager::WriteH3(), G4RootAnalysisManager::WriteH3(), G4XmlAnalysisManager::WriteP1(), G4CsvAnalysisManager::WriteP1(), G4Hdf5AnalysisManager::WriteP1(), G4RootAnalysisManager::WriteP1(), G4XmlAnalysisManager::WriteP2(), G4CsvAnalysisManager::WriteP2(), G4Hdf5AnalysisManager::WriteP2(), G4RootAnalysisManager::WriteP2().


이 클래스에 대한 문서화 페이지는 다음의 파일로부터 생성되었습니다.: