Changeset a87d1e2 for src/Actions/ActionQueue.cpp
- Timestamp:
- Jul 25, 2015, 1:02:12 PM (10 years ago)
- Branches:
- Action_Thermostats, Add_AtomRandomPerturbation, Add_FitFragmentPartialChargesAction, Add_RotateAroundBondAction, Add_SelectAtomByNameAction, Added_ParseSaveFragmentResults, AddingActions_SaveParseParticleParameters, Adding_Graph_to_ChangeBondActions, Adding_MD_integration_tests, Adding_ParticleName_to_Atom, Adding_StructOpt_integration_tests, AtomFragments, Automaking_mpqc_open, AutomationFragmentation_failures, Candidate_v1.5.4, Candidate_v1.6.0, Candidate_v1.6.1, ChangeBugEmailaddress, ChangingTestPorts, ChemicalSpaceEvaluator, CombiningParticlePotentialParsing, Combining_Subpackages, Debian_Package_split, Debian_package_split_molecuildergui_only, Disabling_MemDebug, Docu_Python_wait, EmpiricalPotential_contain_HomologyGraph, EmpiricalPotential_contain_HomologyGraph_documentation, Enable_parallel_make_install, Enhance_userguide, Enhanced_StructuralOptimization, Enhanced_StructuralOptimization_continued, Example_ManyWaysToTranslateAtom, Exclude_Hydrogens_annealWithBondGraph, FitPartialCharges_GlobalError, Fix_BoundInBox_CenterInBox_MoleculeActions, Fix_ChargeSampling_PBC, Fix_ChronosMutex, Fix_FitPartialCharges, Fix_FitPotential_needs_atomicnumbers, Fix_ForceAnnealing, Fix_IndependentFragmentGrids, Fix_ParseParticles, Fix_ParseParticles_split_forward_backward_Actions, Fix_PopActions, Fix_QtFragmentList_sorted_selection, Fix_Restrictedkeyset_FragmentMolecule, Fix_StatusMsg, Fix_StepWorldTime_single_argument, Fix_Verbose_Codepatterns, Fix_fitting_potentials, Fixes, ForceAnnealing_goodresults, ForceAnnealing_oldresults, ForceAnnealing_tocheck, ForceAnnealing_with_BondGraph, ForceAnnealing_with_BondGraph_continued, ForceAnnealing_with_BondGraph_continued_betteresults, ForceAnnealing_with_BondGraph_contraction-expansion, FragmentAction_writes_AtomFragments, FragmentMolecule_checks_bonddegrees, GeometryObjects, Gui_Fixes, Gui_displays_atomic_force_velocity, ImplicitCharges, IndependentFragmentGrids, IndependentFragmentGrids_IndividualZeroInstances, IndependentFragmentGrids_IntegrationTest, IndependentFragmentGrids_Sole_NN_Calculation, JobMarket_RobustOnKillsSegFaults, JobMarket_StableWorkerPool, JobMarket_unresolvable_hostname_fix, MoreRobust_FragmentAutomation, ODR_violation_mpqc_open, PartialCharges_OrthogonalSummation, PdbParser_setsAtomName, PythonUI_with_named_parameters, QtGui_reactivate_TimeChanged_changes, Recreated_GuiChecks, Rewrite_FitPartialCharges, RotateToPrincipalAxisSystem_UndoRedo, SaturateAtoms_findBestMatching, SaturateAtoms_singleDegree, StoppableMakroAction, Subpackage_CodePatterns, Subpackage_JobMarket, Subpackage_LinearAlgebra, Subpackage_levmar, Subpackage_mpqc_open, Subpackage_vmg, Switchable_LogView, ThirdParty_MPQC_rebuilt_buildsystem, TrajectoryDependenant_MaxOrder, TremoloParser_IncreasedPrecision, TremoloParser_MultipleTimesteps, TremoloParser_setsAtomName, Ubuntu_1604_changes, stable
- Children:
- 9a4880
- Parents:
- 9ec4b8
- git-author:
- Frederik Heber <heber@…> (06/18/15 00:56:26)
- git-committer:
- Frederik Heber <heber@…> (07/25/15 13:02:12)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Actions/ActionQueue.cpp
r9ec4b8 ra87d1e2 63 63 history(new ActionHistory), 64 64 lastActionOk(true), 65 #ifdef HAVE_ACTION_THREAD66 65 CurrentAction(0), 66 #ifdef HAVE_ACTION_THREAD 67 67 run_thread(boost::bind(&ActionQueue::run, this)), 68 68 run_thread_isIdle(true), … … 108 108 #ifndef HAVE_ACTION_THREAD 109 109 try { 110 if (!isDryRun(newaction)) 110 if (!isDryRun(newaction)) { 111 CurrentAction = actionqueue.size()-1; 111 112 newaction->call(); 113 CurrentAction = actionqueue.size(); 114 } 112 115 lastActionOk = true; 113 116 } catch(ActionFailureException &e) { … … 130 133 } 131 134 #else 132 setRunThreadIdle(CurrentAction == actionqueue.size());133 135 mtx_queue.unlock(); 136 setRunThreadIdle(isIdle()); 134 137 #endif 135 138 } … … 144 147 mtx_queue.lock(); 145 148 tempqueue.push_back( newaction ); 146 setRunThreadIdle( !((CurrentAction != actionqueue.size()) || !tempqueue.empty()));149 const bool tempqueue_notempty = !tempqueue.empty(); 147 150 mtx_queue.unlock(); 148 #endif 151 setRunThreadIdle( !((!isIdle()) || tempqueue_notempty) ); 152 #endif 153 } 154 155 bool ActionQueue::isIdle() const 156 { 157 #ifdef HAVE_ACTION_THREAD 158 boost::unique_lock<boost::mutex> lock(mtx_queue); 159 #endif 160 bool status = (CurrentAction == actionqueue.size()); 161 return status; 149 162 } 150 163 … … 169 182 mtx_queue.lock(); 170 183 insertTempQueue(); 171 bool status = (CurrentAction != actionqueue.size());172 184 mtx_queue.unlock(); 185 bool status = !isIdle(); 173 186 while (status) { 174 187 // boost::this_thread::disable_interruption di; … … 208 221 // while an action instance is "in-use" 209 222 insertTempQueue(); 210 status = (CurrentAction != actionqueue.size());211 223 mtx_queue.unlock(); 224 status = !isIdle(); 212 225 } 213 setRunThreadIdle( !((CurrentAction != actionqueue.size()) || !tempqueue.empty()) ); 226 mtx_queue.lock(); 227 const bool tempqueue_notempty = !tempqueue.empty(); 228 mtx_queue.unlock(); 229 setRunThreadIdle( !((!isIdle()) || tempqueue_notempty) ); 214 230 cond_idle.notify_one(); 215 231 // LOG(1, "DEBUG: End of ActionQueue's run() loop.");
Note:
See TracChangeset
for help on using the changeset viewer.