public PressureMonitorConsumer(ConcurrentQueue <PressureContainer> containerQueue, AutoResetEvent autoResetEvent, PressureContainer container) { _containerQueue = containerQueue; _autoResetEvent = autoResetEvent; _pressureContainer = container; }
static void Main() { AutoResetEvent _dataReady = new AutoResetEvent(false); ConcurrentQueue <PressureContainer> _containerqueue = new ConcurrentQueue <PressureContainer>(); PressureContainer _pressureContainer = new PressureContainer(); TirePressureProducer _producer = new TirePressureProducer(_containerqueue); PressureMonitorConsumer _consumer = new PressureMonitorConsumer(_containerqueue, _dataReady, _pressureContainer); PressureSensor _sensor = new PressureSensor(_pressureContainer, _dataReady); Thread _producerThread = new Thread(_producer.Run); Thread _consumerThread = new Thread(_consumer.ConsumePressure); Thread _sensorThread = new Thread(_sensor.CheckPressure); _consumerThread.Start(); _producerThread.Start(); _sensorThread.Start(); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new Form1(_sensor)); }
public TirePressureProducer(ConcurrentQueue <PressureContainer> containerqueue) { _containerQueue = containerqueue; _pressureContainer = new PressureContainer(); }
public PressureSensor(PressureContainer pressureContainer, AutoResetEvent autoResetEvent) { _pressureContainer = pressureContainer; _autoResetEvent = autoResetEvent; }