예제 #1
0
        void GetLuggage()
        {
            while (true)
            {
                Monitor.Enter(IncomingLuggage);
                while (IncomingLuggage.Count == 0)
                {
                    //Wait for luggage to come in, and immediately send it out
                    Monitor.Wait(IncomingLuggage);
                }
                LuggageSent?.Invoke(this, EventArgs.Empty);

                for (int i = 0; i < rnd.Next(0, IncomingLuggage.Count); i++)
                {
                    SplitLuggage(IncomingLuggage.Dequeue());
                }



                Monitor.Exit(IncomingLuggage);

                Thread.Sleep(rnd.Next(100, 300));
            }
        }
예제 #2
0
파일: Simulation.cs 프로젝트: KavTV/H2
 private void Splitter_LuggageSent(object sender, EventArgs e)
 {
     LuggageSent?.Invoke(this, e);
 }