00001 #ifndef _CK_OBJQ_H_ 00002 #define _CK_OBJQ_H_ 00003 00004 #include "cklists.h" 00005 00006 class Chare; 00007 00008 // Converse token message 00009 class ObjectToken { 00010 public: 00011 char core[CmiMsgHeaderSizeBytes]; 00012 Chare *objPtr; // pointer to object 00013 void *message; // envelope 00014 }; 00015 00016 // object message queue 00017 class CkObjectMsgQ { 00018 private: 00019 void * objQ; 00020 public: 00021 CkObjectMsgQ(): objQ(NULL) {} 00022 ~CkObjectMsgQ(); 00023 inline void *queue() { return objQ; } 00024 void create(); 00025 int length() const; 00026 void process(); 00027 }; 00028 00029 class TokenPool: public SafePool<ObjectToken*> { 00030 private: 00031 static inline ObjectToken *_alloc(void) { 00032 return (ObjectToken*)CmiAlloc(sizeof(ObjectToken)); 00033 } 00034 static inline void _free(ObjectToken *ptr) { 00035 CmiFree((void*)ptr); 00036 } 00037 public: 00038 TokenPool(): SafePool<ObjectToken*>(_alloc, _free) {} 00039 }; 00040 00041 CkpvExtern(TokenPool*, _tokenPool); 00042 00043 Chare * CkFindObjectPtr(envelope *); 00044 void _enqObjQueue(Chare *obj, envelope *env); 00045 void _ObjectQHandler(void *converseMsg); 00046 void _TokenHandler(void *tokenMsg); 00047 00048 #endif