#pragma once #include "BargingCheckBridge.h" #if defined( INT ) // internal scheduling monitor solution _Monitor Bridge { private: Printer & printer; BCHECK_DECL; // YOU ADD DECLARATIONS AND MEMBERS #elif defined( EXT ) // external scheduling monitor solution _Monitor Bridge { private: Printer & printer; BCHECK_DECL; // YOU ADD DECLARATIONS AND MEMBERS #elif defined( AUTO ) // automatic-signal monitor solution #include "AutomaticSignal.h" _Monitor Bridge { private: Printer & printer; AUTOMATIC_SIGNAL; BCHECK_DECL; // YOU ADD DECLARATIONS AND MEMBERS #elif defined( NEST ) // nested monitor solution _Monitor Bridge { private: Printer & printer; public: _Monitor BridgeNested { private: Printer & printer; BCHECK_DECL; public: void startNorth( unsigned int id __attribute__(( unused )) ); void startSouth( unsigned int id __attribute__(( unused )) ); void endNorth( unsigned int id __attribute__(( unused )) ); void endSouth( unsigned int id __attribute__(( unused )) ); }; private: // YOU ADD DECLARATIONS AND MEMBERS #elif defined( INTB ) // internal scheduling monitor solution with barging _Monitor Bridge { private: Printer & printer; uCondition bench; // only bench for tasks to block on BCHECK_DECL; void wait(); // barging version of wait void signalAll(); #elif defined( TASK ) // task solution _Task Bridge { private: Printer & printer; void main(); // YOU ADD DECLARATIONS AND MEMBERS #else #error unsupported bridge type #endif #if defined( NEST ) _Nomutex void endNorth( unsigned int id __attribute__(( unused )) ); _Nomutex void endSouth( unsigned int id __attribute__(( unused )) ); #else _Mutex void endNorth( unsigned int id __attribute__(( unused )) ); _Mutex void endSouth( unsigned int id __attribute__(( unused )) ); #endif #if defined( TASK ) _Mutex FTicket & startNorth( unsigned int id __attribute__(( unused ))); _Mutex FTicket & startSouth( unsigned int id __attribute__(( unused )) ); public: enum Direction { NORTH = 'N', SOUTH = 'S' }; _Nomutex void cross( unsigned int id __attribute__(( unused )), Direction dir ) { // YOU WRITE THIS CODE } // cross #else _Mutex void startNorth( unsigned int id __attribute__(( unused )) ); _Mutex void startSouth( unsigned int id __attribute__(( unused )) ); public: // common interface enum Direction { NORTH = 'N', SOUTH = 'S' }; _Nomutex void cross( unsigned int id __attribute__(( unused )), Direction dir ) { // YOU WRITE THIS CODE } // cross #endif }; // Bridge // Local Variables: // // tab-width: 4 // // mode: c++ // // compile-command: "make bridge BIMPL=EXT" // // End: //