• Classes
  • Modules
  • Namespaces
  • Files
  • Related Pages
  • File List
  • File Members

acsncBlockingQueue.h

Go to the documentation of this file.
00001 #ifndef ACS_NC_BLOCKING_QUEUE_H_
00002 #define ACS_NC_BLOCKING_QUEUE_H_
00003 #include <queue>
00004 #include <exception>
00005 #include <pthread.h>
00006 #include <tao/corba.h>
00007 
00008 #define ACS_NC_CONSUMER_MAX_BUFFER_SIZE 100
00009 
00010 namespace nc {
00011 
00012 template<class T>
00013 struct event_info {
00014     T event;
00015     double maxProcessTime;
00016     std::string type_name;
00017     event_info(T &event, double &maxProcessTime, std::string & type_name);
00018     event_info(T &event, double &maxProcessTime, const char *type_name);
00019 };
00020 
00021 template<class T>
00022 class blocking_queue {
00023 private:
00024     std::queue<event_info<T> > buffer;
00025     pthread_mutex_t mutex;
00026     pthread_cond_t cond;
00027 
00028 public:
00029     blocking_queue();
00030     ~blocking_queue();
00031     void push (event_info<T> &data);
00035     event_info<T> pop();
00036     unsigned int size();
00037     void unblock();
00038 };
00039 
00040 class interrupted_blocking_queue: public std::exception {
00041 };
00042 
00043 }
00044 #include "acsncBlockingQueue.i"
00045 
00046 #endif

Generated on Thu Jan 12 2012 23:13:50 for ACS-10.0 C++ API by  doxygen 1.7.0