Message: Re: thread sybchronization Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

Idea Re: thread sybchronization 

Forum: Multithreading
Re: Question thread sybchronization (Andrea Di Simone)
Date: 07 Nov, 2012
From: Andrea Dotti <Andrea Dotti>

Hi Andrea, worker threads are started at the event loop. This is what happens:

The master thread executes your "main" function. When the /run/beamOn command is applied and the event loop is started, worker threads are created and your "main" function runs for each thread (remember the main function is not the one you have written yourself, see the very last line of G4MTParTopC.icc).

> if (threadRank == 0){
> theDetector=new MyDetectorConstruction();
> } else {
> theDetector->SlaveDetectorConstruction();
> }

Thus, in your snippet of the code the else branch is guaranteed to be executed after the if( true ) branch. See: G4MTParRunManager::DoEventLoop(...) member function.


 Add Message Add Message
to: "Re: thread sybchronization"

 Subscribe Subscribe

This site runs SLAC HyperNews version 1.11-slac-98, derived from the original HyperNews