ck-core/waitqd.C

Go to the documentation of this file.
00001 /*****************************************************************************
00002  * $Source: /cvsroot/charm/src/ck-core/waitqd.C,v $
00003  * $Author: chao $
00004  * $Date: 2003-09-12 15:24:02 $
00005  * $Revision: 2.13 $
00006  *****************************************************************************/
00007 
00008 #include "waitqd.h"
00009 
00010 /* readonly */ 
00011 CkChareID _waitqd_qdhandle;
00012 
00013 extern "C" void CkWaitQD(void) {
00014   CProxy_waitqd_QDChare qdchareproxy(_waitqd_qdhandle);
00015   qdchareproxy.waitQD();
00016 }
00017   
00018 waitqd_QDChare::waitqd_QDChare(CkArgMsg *m) {
00019   waitStarted = 0;
00020   threadList = 0;
00021   _waitqd_qdhandle = thishandle;
00022   delete m;
00023 }
00024 
00025 void waitqd_QDChare::waitQD(void) {
00026   if (waitStarted == 1) {
00027     CdsFifo_Enqueue((CdsFifo)threadList, (void *)CthSelf());
00028   } else {
00029     waitStarted = 1;
00030     threadList = (void*) CdsFifo_Create();
00031     CdsFifo_Enqueue((CdsFifo) threadList, (void *)CthSelf());
00032     CkStartQD(CkIndex_waitqd_QDChare::onQD((CkQdMsg*)0), &thishandle);
00033   }
00034   CthSuspend();
00035 }
00036 
00037 void waitqd_QDChare::onQD(CkQdMsg *ckqm) {
00038   CthThread pthr;
00039   while(!CdsFifo_Empty((CdsFifo) threadList)) {
00040     pthr = (CthThread)CdsFifo_Dequeue((CdsFifo) threadList);
00041     CthAwaken(pthr);
00042   }
00043   CdsFifo_Destroy((CdsFifo) threadList);
00044   threadList = 0;
00045   waitStarted = 0;
00046   delete ckqm;
00047 }
00048 
00049 #include "waitqd.def.h"

Generated on Sun Jun 29 13:29:09 2008 for Charm++ by  doxygen 1.5.1