#ifndef _Brooks0254Set_ #define _Brooks0254Set_ #include #include #include #define _OPEN_THREADS #include #include #include #include #include #include "Brooks0254Chassis.hh" #include "Brooks0254Par.hh" #include "Brooks0254GlobPar.hh" class Brooks0254ChassisID { public: unsigned id; string dev; unsigned addr; Brooks0254ChassisID( unsigned tid, string tdev, unsigned taddr ) : id(tid), dev(tdev), addr(taddr) {;} }; class Brooks0254Set { private: // No instances of this class will be allowed Brooks0254Set(); Brooks0254Set( const Brooks0254Set& set ); Brooks0254Set& operator=( const Brooks0254Set& set ); public: static int bsDummyInt; static pthread_mutex_t bsGlobMutex; //! Global mutex for this class static pthread_mutexattr_t bsGlobMtxAttr; //! Global mutex attributes static pthread_cond_t bsThrdStop; //! Condidtion variable for stopping thread static unsigned long bsSleepTime; //! Sleep time between scans // Map of all chassis including the exit request and the pointer to the chassis static map > bsDevMap; static int StartDevice( unsigned portID, unsigned addr, const char* devName ); static int StopDevice( int portID ); static void* Thread( void* argPtr ); static void Loop( unsigned portID ) ; static Brooks0254Chassis* GetChassisPtr( unsigned chassis ); static bool GetChassisFlag( unsigned chassis ); static int InitGlobalMutex(); // Initialize global mutex inline static int GlobLock() // Lock static structures access { return pthread_mutex_lock( &bsGlobMutex ); } inline static int GlobUnlock() // Unlock static structures access { return pthread_mutex_unlock( &bsGlobMutex ); } }; #endif