コード例 #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);
 }