Main Page | Namespace List | Class Hierarchy | Class List | File List | Class Members | File Members

TuplesAvailableMailbox.h

Go to the documentation of this file.
00001 #ifndef TUPLESAVAILABLEMAILBOX_H 00002 #define TUPLESAVAILABLEMAILBOX_H 00003 00004 #include <set> 00005 #include <pthread.h> 00006 00007 #include "common.h" 00008 00009 BOREALIS_NAMESPACE_BEGIN; 00010 00011 class TupleQueue; 00012 00013 typedef TupleQueue* TupleQueuePtr; 00014 00022 class TuplesAvailableMailbox { 00023 public: 00024 TuplesAvailableMailbox(); 00025 virtual ~TuplesAvailableMailbox(); 00026 00027 // Call this when the specified TupleQueue has gone from being empty to 00028 // being non-empty. 00029 // 00030 // Don't call this any time after you've started calling close(). 00031 void onNonEmpty(TupleQueue * pTQ); 00032 00033 // Call this method when this data structure is all done. This will cause 00034 // any currently blocking call to getEvent() to unblock. 00035 void close(); 00036 00037 // If this returns true, then pTQ has been set to the address of a TupleQueue 00038 // that has become non-empty. Concurrently pending non-empty reports form 00039 // the same TupleQueue will be reported just once to the caller. 00040 // 00041 // If this returns false, then close() has been called. 00042 // 00043 // This method blocks until an event exists to report or close() has been 00044 // called. 00045 bool getEvent(TupleQueuePtr & pTQ); 00046 00047 private: 00048 set<TupleQueue*> _unreceivedReports; 00049 bool _closed; 00050 pthread_cond_t _cond; 00051 pthread_mutex_t _mtx; 00052 }; 00053 00054 BOREALIS_NAMESPACE_END; 00055 00056 #endif

Generated on Fri Nov 12 15:15:22 2004 for Borealis by doxygen 1.3.8