Esempio n. 1
0
 public PressureMonitorConsumer(ConcurrentQueue <PressureContainer> containerQueue, AutoResetEvent autoResetEvent,
                                PressureContainer container)
 {
     _containerQueue    = containerQueue;
     _autoResetEvent    = autoResetEvent;
     _pressureContainer = container;
 }
Esempio n. 2
0
        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));
        }
Esempio n. 3
0
 public TirePressureProducer(ConcurrentQueue <PressureContainer> containerqueue)
 {
     _containerQueue    = containerqueue;
     _pressureContainer = new PressureContainer();
 }
Esempio n. 4
0
 public PressureSensor(PressureContainer pressureContainer, AutoResetEvent autoResetEvent)
 {
     _pressureContainer = pressureContainer;
     _autoResetEvent    = autoResetEvent;
 }