Changeset 74459a for src/Actions/ActionQueue.cpp
- Timestamp:
- May 20, 2014, 9:14:56 AM (11 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:
- caece4
- Parents:
- 415ddd
- git-author:
- Frederik Heber <heber@…> (02/19/14 19:35:28)
- git-committer:
- Frederik Heber <heber@…> (05/20/14 09:14:56)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Actions/ActionQueue.cpp
r415ddd r74459a 58 58 AR(new ActionRegistry()), 59 59 history(new ActionHistory), 60 #ifndef HAVE_ACTION_THREAD 61 CurrentAction(0) 62 #else 60 63 CurrentAction(0), 61 64 run_thread(boost::bind(&ActionQueue::run, this)), 62 65 run_thread_isIdle(true) 66 #endif 63 67 {} 64 68 65 69 ActionQueue::~ActionQueue() 66 70 { 71 #ifdef HAVE_ACTION_THREAD 67 72 stop(); 73 #endif 68 74 69 75 // free all actions contained in actionqueue … … 86 92 Action *newaction = _action->clone(state); 87 93 newaction->prepare(state); 94 #ifdef HAVE_ACTION_THREAD 88 95 mtx_queue.lock(); 96 #endif 89 97 actionqueue.push_back( newaction ); 98 #ifndef HAVE_ACTION_THREAD 99 try { 100 newaction->call(); 101 } catch(ActionFailureException &e) { 102 std::cerr << "Action " << *boost::get_error_info<ActionNameString>(e) << " has failed." << std::endl; 103 World::getInstance().setExitFlag(5); 104 } 105 #else 90 106 { 91 107 boost::lock_guard<boost::mutex> lock(mtx_idle); … … 93 109 } 94 110 mtx_queue.unlock(); 111 #endif 95 112 } 96 113 97 114 void ActionQueue::insertAction(Action *_action, enum Action::QueryOptions state) 98 115 { 116 #ifndef HAVE_ACTION_THREAD 117 queueAction(_action, state); 118 #else 99 119 Action *newaction = _action->clone(state); 100 120 newaction->prepare(state); … … 106 126 } 107 127 mtx_queue.unlock(); 108 } 109 128 #endif 129 } 130 131 #ifdef HAVE_ACTION_THREAD 110 132 void ActionQueue::run() 111 133 { … … 157 179 } while (!Interrupted); 158 180 } 181 #endif 159 182 160 183 void ActionQueue::insertTempQueue() … … 168 191 } 169 192 193 #ifdef HAVE_ACTION_THREAD 170 194 void ActionQueue::wait() 171 195 { … … 176 200 } 177 201 } 178 202 #endif 203 204 #ifdef HAVE_ACTION_THREAD 179 205 void ActionQueue::stop() 180 206 { … … 184 210 run_thread.join(); 185 211 } 212 #endif 186 213 187 214 Action* ActionQueue::getActionByName(const std::string &name)
Note:
See TracChangeset
for help on using the changeset viewer.