Changeset 3eb035
- Timestamp:
- Jul 2, 2012, 7:54:13 AM (13 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:
- 86a1e8
- Parents:
- d76161
- git-author:
- Frederik Heber <heber@…> (04/24/12 10:38:54)
- git-committer:
- Frederik Heber <heber@…> (07/02/12 07:54:13)
- Location:
- src/Fragmentation/Automation
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Fragmentation/Automation/Pool/WorkerPool.cpp
rd76161 r3eb035 154 154 Pool_t::iterator iter = pool.find( address ); 155 155 if (iter != pool.end()) { 156 OBSERVE;157 NOTIFY(WorkerRemoved);158 156 Idle_Queue_t::iterator idleiter = getIdleWorker(address); 159 157 if (idleiter != idle_queue.end()) … … 182 180 void WorkerPool::removeAllWorkers() 183 181 { 184 OBSERVE;185 NOTIFY(WorkerRemoved);186 182 // empty pool and queue 187 183 idle_queue.clear(); -
src/Fragmentation/Automation/Pool/WorkerPool.hpp
rd76161 r3eb035 39 39 ~WorkerPool(); 40 40 41 /** Channels for this observable. 42 * 43 * \note Be especially cautious of cyclic updates here as the updates are 44 * used by \ref FragmentScheduler to send new jobs to idle workers! 45 * If e.g. WorkerRemoved is added, then the marking of the one idle 46 * worker as now busy inside the callback will cause a cycle in the 47 * update, as the notification for WorkerIdle/Added is not yet 48 * removed because we are still inside the callback! 49 */ 41 50 enum NotificationType { 42 51 WorkerIdle, 43 52 WorkerAdded, 44 WorkerRemoved,45 53 NotificationType_MAX // denotes the maximum of available notification types 46 54 }; -
src/Fragmentation/Automation/unittests/WorkerPoolUnitTest.cpp
rd76161 r3eb035 52 52 pool = new WorkerPool(); 53 53 addobserver = new NotificationObserver(pool->getChannel(WorkerPool::WorkerAdded)); 54 removeobserver = new NotificationObserver(pool->getChannel(WorkerPool::WorkerRemoved));55 54 idleobserver = new NotificationObserver(pool->getChannel(WorkerPool::WorkerIdle)); 56 55 57 56 // and sign on 58 57 pool->signOn(addobserver, WorkerPool::WorkerAdded); 59 pool->signOn(removeobserver, WorkerPool::WorkerRemoved);60 58 pool->signOn(idleobserver, WorkerPool::WorkerIdle); 61 59 } … … 64 62 { 65 63 pool->signOff(addobserver, WorkerPool::WorkerAdded); 66 pool->signOff(removeobserver, WorkerPool::WorkerRemoved);67 64 pool->signOff(idleobserver, WorkerPool::WorkerIdle); 68 65 69 delete removeobserver;70 66 delete addobserver; 71 67 delete idleobserver; … … 92 88 CPPUNIT_ASSERT_EQUAL( address, pool->begin_idle()->second ); 93 89 CPPUNIT_ASSERT( addobserver->wasNotified ); 94 CPPUNIT_ASSERT( !removeobserver->wasNotified );95 90 CPPUNIT_ASSERT( idleobserver->wasNotified ); 96 91 addobserver->wasNotified = false; … … 101 96 CPPUNIT_ASSERT( !pool->removeWorker(otheraddress) ); 102 97 CPPUNIT_ASSERT( !addobserver->wasNotified ); 103 CPPUNIT_ASSERT( !removeobserver->wasNotified );104 98 CPPUNIT_ASSERT( !idleobserver->wasNotified ); 105 99 … … 114 108 CPPUNIT_ASSERT_EQUAL( (size_t)0, pool->pool.size() ); 115 109 CPPUNIT_ASSERT( !addobserver->wasNotified ); 116 CPPUNIT_ASSERT( removeobserver->wasNotified );117 110 CPPUNIT_ASSERT( !idleobserver->wasNotified ); 118 removeobserver->wasNotified = false;119 111 } 120 112 … … 133 125 CPPUNIT_ASSERT_EQUAL( (size_t)1, pool->pool.size() ); 134 126 CPPUNIT_ASSERT( addobserver->wasNotified ); 135 CPPUNIT_ASSERT( !removeobserver->wasNotified );136 127 CPPUNIT_ASSERT( idleobserver->wasNotified ); 137 128 addobserver->wasNotified = false; … … 163 154 CPPUNIT_ASSERT_EQUAL( (size_t)1, pool->busy_queue.size() ); 164 155 CPPUNIT_ASSERT( !addobserver->wasNotified ); 165 CPPUNIT_ASSERT( !removeobserver->wasNotified );166 156 CPPUNIT_ASSERT( !idleobserver->wasNotified ); 167 157 … … 172 162 CPPUNIT_ASSERT_EQUAL( (size_t)0, pool->busy_queue.size() ); 173 163 CPPUNIT_ASSERT( !addobserver->wasNotified ); 174 CPPUNIT_ASSERT( !removeobserver->wasNotified );175 164 CPPUNIT_ASSERT( idleobserver->wasNotified ); 176 165 } -
src/Fragmentation/Automation/unittests/WorkerPoolUnitTest.hpp
rd76161 r3eb035 38 38 WorkerPool *pool; 39 39 NotificationObserver *addobserver; 40 NotificationObserver *removeobserver;41 40 NotificationObserver *idleobserver; 42 41 };
Note:
See TracChangeset
for help on using the changeset viewer.