00001 #ifndef _CLUSTER_SHMEM2EVT_H_ 00002 #define _CLUSTER_SHMEM2EVT_H_ 00003 00004 #include <dev/polled.H> 00005 00006 enum { SHMEM_TERM_FLAG=0, 00007 SHMEM_GLUE_ATTACHED_FLAG, 00008 00009 SHMEM_READY_FOR_DATA_FLAG, 00010 SHMEM_ALL_READY_FOR_DATA_FLAG, 00011 SHMEM_PROCESSED_DATA_FLAG, 00012 SHMEM_ALL_PROCESSED_DATA_FLAG, 00013 00014 SHMEM_NUM_FLAGS }; 00015 00016 const int SHORT_SLEEP = 100; // microseconds 00017 00018 class SimpleSHMEM; 00019 class SimpleSemaphore; 00020 00021 class Cluster_shmem2evt : public DEVpolled 00022 { 00023 protected: 00024 SimpleSHMEM *_shmem_device_data; 00025 SimpleSHMEM *_shmem_flags; 00026 SimpleSemaphore *_semaphore_device_data; 00027 00028 // So, in term, we don't block on our own shmem lock 00029 bool _shmem_lock_is_mine; 00030 bool _has_terminated; 00031 00032 int _event_buffer_size; 00033 char *_event_buffer; 00034 00035 00036 00037 public: 00038 Cluster_shmem2evt( Cstr_ptr &name = "Cluster_shmem2evt" ); 00039 virtual ~Cluster_shmem2evt(); 00040 00041 void do_poll(); 00042 void terminate(); 00043 00044 int _stale_data_cnt; 00045 00046 }; 00047 00048 00049 #endif 00050