[Avida-SVN] r2640 - in branches/jobScheduling/source: cpu main

beckma24 at myxo.css.msu.edu beckma24 at myxo.css.msu.edu
Tue Jun 10 14:32:33 PDT 2008


Author: beckma24
Date: 2008-06-10 17:32:33 -0400 (Tue, 10 Jun 2008)
New Revision: 2640

Modified:
   branches/jobScheduling/source/cpu/cHardwareBase.cc
   branches/jobScheduling/source/cpu/cHardwareCPU.cc
   branches/jobScheduling/source/main/cPopulation.cc
Log:
Made sleep atomic

Modified: branches/jobScheduling/source/cpu/cHardwareBase.cc
===================================================================
--- branches/jobScheduling/source/cpu/cHardwareBase.cc	2008-06-10 20:21:19 UTC (rev 2639)
+++ branches/jobScheduling/source/cpu/cHardwareBase.cc	2008-06-10 21:32:33 UTC (rev 2640)
@@ -857,8 +857,8 @@
           if(m_world->GetConfig().LOG_SLEEP_TIMES.Get() == 1) {
             pop.AddBeginSleep(cellID,m_world->GetStats().GetUpdate());
           }
-          pop.GetCell(cellID).GetOrganism()->SetSleeping(true);
-          pop.GetCell(cellID).GetOrganism()->GetOrgInterface().GetDeme()->IncSleepingCount();
+          organism->SetSleeping(true);
+          organism->GetOrgInterface().GetDeme()->IncSleepingCount();
         }
       } else {
         organism->GetPhenotype().SetToDie();

Modified: branches/jobScheduling/source/cpu/cHardwareCPU.cc
===================================================================
--- branches/jobScheduling/source/cpu/cHardwareCPU.cc	2008-06-10 20:21:19 UTC (rev 2639)
+++ branches/jobScheduling/source/cpu/cHardwareCPU.cc	2008-06-10 21:32:33 UTC (rev 2640)
@@ -4542,7 +4542,6 @@
   }
   organism->SetSleeping(false);  //this instruction get executed at the end of a sleep cycle
   GetOrganism()->GetOrgInterface().GetDeme()->DecSleepingCount();
-//  m_world->GetStats().decNumAsleep(pop.GetCell(cellID).GetDemeID());
   if(m_world->GetConfig().APPLY_ENERGY_METHOD.Get() == 2) {
     organism->GetPhenotype().RefreshEnergy();
     organism->GetPhenotype().ApplyToEnergyStore();
@@ -5006,6 +5005,10 @@
 }
 
 bool cHardwareCPU::Jump_To_Alarm_Label(int jump_label) {
+  if(organism->IsSleeping()) {
+    return false;
+  }
+
   cString channel;
   
   if(jump_label == 1) {
@@ -5027,11 +5030,6 @@
       // move IP to here
       IP().Set(search_head.GetPosition());
       m_advance_ip = false; // Don't automatically move the IP
-      if(organism->IsSleeping()) {
-        organism->SetSleeping(false);
-        GetOrganism()->GetOrgInterface().GetDeme()->DecSleepingCount();
-//        m_world->GetStats().decNumAsleep(organism->GetOrgInterface().GetDemeID());
-      }
       return true;
     }
     search_head++;

Modified: branches/jobScheduling/source/main/cPopulation.cc
===================================================================
--- branches/jobScheduling/source/main/cPopulation.cc	2008-06-10 20:21:19 UTC (rev 2639)
+++ branches/jobScheduling/source/main/cPopulation.cc	2008-06-10 21:32:33 UTC (rev 2640)
@@ -658,7 +658,6 @@
   if(organism->IsSleeping()) {
     organism->SetSleeping(false);
     organism->GetOrgInterface().GetDeme()->DecSleepingCount();
-//    m_world->GetStats().decNumAsleep(GetCell(cellID).GetDemeID());
   }
   if(m_world->GetConfig().LOG_SLEEP_TIMES.Get() == 1) {
     if(sleep_log[cellID].Size() > 0) {




More information about the Avida-cvs mailing list