Exemplo n.º 1
0
 public BankClient(Bank_Queue pBank, int iFromAccount, double dbMaxAccount)
 {
     this.m_bBank = pBank;
     // this.m_pQueue = pQueue;
     this.m_iFromAccount = iFromAccount;
     this.m_maxAmount    = dbMaxAccount;
 }
Exemplo n.º 2
0
        public static void ThreadQueueTest()
        {
            int    iAcountCount = 100;
            double iLimitMoney  = 1000;

            Bank_Queue pBank = new Bank_Queue(iAcountCount, iLimitMoney);

            Thread pThBack  = new Thread(pBank.TransferX);
            Thread pThBack2 = new Thread(pBank.Listener);

            pThBack.Start();
            pThBack2.Start();

            for (int i = 0; i < iAcountCount; i++)
            {
                BankClient clie   = new BankClient(pBank, i, iLimitMoney);
                Thread     thread = new Thread(clie.run);
                thread.Start();
            }
        }