diff TaskManager/Cell/spe/CellDmaManager.cc @ 1021:f8e9c985e2a8

use MailManager
author yutaka@localhost.localdomain
date Sun, 07 Nov 2010 22:10:29 +0900
parents 80b18af207c2
children 5245cf19775d
line wrap: on
line diff
--- a/TaskManager/Cell/spe/CellDmaManager.cc	Fri Nov 05 23:10:11 2010 +0900
+++ b/TaskManager/Cell/spe/CellDmaManager.cc	Sun Nov 07 22:10:29 2010 +0900
@@ -5,8 +5,6 @@
 
 
 unsigned long long alloc_flag = 0;
-// singleton
-QueueInfo<MailQueue> *MailPool = new QueueInfo<MailQueue>() ;
 
 /**
  * DMA Load
@@ -91,20 +89,34 @@
 {
     (this->*start_dmawait_profile)();
     if (0 != spu_readchcnt(SPU_WrOutMbox)) {
-      if (mail_queue->empty()) {
+      //if (mail_queue->empty()) {
+      if (mail_queue->count()) {
           spu_write_out_mbox((uint32)data);
       } else {
+	/*
 	  MailQueuePtr mail = mail_queue->poll();
 	  spu_write_out_mbox((uint32)mail->data);
 	  mail_queue->free_(mail);
 	  mail = mail_queue->create();
 	  mail->data = data;
 	  mail_queue->addLast(mail);
+	*/
+
+	//mail_queue から poll する
+	spu_write_out_mbox((uint32)mail_queue->recv());
+	//mail_queue に加える
+	mail_queue->send(data);
+
       }
     } else {
+      /*
         MailQueuePtr mail = mail_queue->create();
 	mail->data = data;
 	mail_queue->addLast(mail);
+      */
+
+      mail_queue->send(data);
+
     }
     (this->*end_dmawait_profile)(&global_mail_time);
 }
@@ -115,10 +127,16 @@
 
     (this->*start_dmawait_profile)();
 
-    while (!mail_queue->empty()) {
+    //while (!mail_queue->empty()) {
+    while (mail_queue->count()) {
+      /*
       MailQueuePtr mail = mail_queue->poll();
       spu_write_out_mbox((uint32)mail->data);      
       mail_queue->free_(mail);
+      */
+
+      spu_write_out_mbox((uint32)mail_queue->recv());      
+
     }
 
     spu_write_out_mbox((uint32)data);
@@ -156,7 +174,7 @@
 CellDmaManager::CellDmaManager() 
 {
 
-    mail_queue = new QueueInfo<MailQueue>(MailPool);
+    mail_queue = new MailManager();
     stop_profile();
 }
 void