BroadcastClient.C

Go to the documentation of this file.
00001 
00007 #include "InfoStream.h"
00008 #include "charm++.h"
00009 #include "BroadcastMgr.h"
00010 #include "BroadcastClient.h"
00011 #define MIN_DEBUG_LEVEL 3
00012 // #define DEBUGM
00013 #include "Debug.h"
00014 
00015 BroadcastClient::BroadcastClient(int id) {
00016   this->id = id;
00017   BroadcastMgr::Object()->subscribe(*this);
00018   waitForTag = -1;
00019   suspended = 0;
00020 }
00021 
00022 BroadcastClient::~BroadcastClient() {
00023   BroadcastMgr::Object()->unsubscribe(*this);
00024 }
00025 
00026 void 
00027 BroadcastClient::awaken(int theid, int tag) {
00028   DebugM(1, "awaken() client id = " << id << " tag = " << tag << "\n");
00029   if (suspended && theid == this->id && tag == waitForTag) {
00030     CthAwaken(thread);
00031     suspended = 0; waitForTag = -1;
00032   }
00033 }
00034 
00035 void 
00036 BroadcastClient::suspendFor(int tag) {
00037   DebugM(1, "suspending() client id = " << id << " tag = " << tag << "\n");
00038   suspended = 1;
00039   waitForTag = tag;
00040   thread = CthSelf();
00041   CthSuspend();
00042 }
00043 

Generated on Mon Nov 20 01:17:10 2017 for NAMD by  doxygen 1.4.7