コード例 #1
0
        public void Run(int tickResult)
        {
            DEOS.Inc();

            if (tickResult == Clock.NOTIMECHANGE)
            {
                DEOS.println("No interrupts!");
                DEOS.println(thread.ToString() + " waiting until next period");
                DEOSKernel.WaitUntilNextPeriodK(thread); //yieldCPU();
            }
            else
            {
                if (DEOS.RandBool())
                {
                    DEOS.println("---Choice 0 of main---");
                    DEOS.println(thread.ToString() + " waiting until next period");
                    DEOSKernel.WaitUntilNextPeriodK(thread);
                }
                else
                {
                    DEOS.println("---Choice 1 of main---");

                    GetInterrupted(tickResult);
                }
            }
        }
コード例 #2
0
        public void Run(int tickResult)
        {
            //Verify.assertTrue(Timer.timer || Timer.tick);
            DEOS.Inc();

            if (tickResult == Clock.NOTIMECHANGE)
            {
                if (DEOS.RandBool())
                {
                    //System.out.println("Thread: " + thread + " - Depth: " + depth);
                    DEOS.println("No interrupt - Choice 0:");
                    DEOS.println(thread.ToString() + " waiting until next period");
                    DEOSKernel.WaitUntilNextPeriodK(thread);

                    //yieldCPU();
                }
                else
                {
                    //System.out.println("Thread: " + thread + " - Depth: " + depth);
                    DEOS.println("No interrupt - Choice 1:");
                    DEOS.println(thread.ToString() + " deleting");
                    int result = DEOSKernel.DeleteThreadK(thread); //deleteThread();
                    logger.Info("{threadName}|{result}", thread.ToString(), result);
                }
            }
            else
            {
                Random rand = new Random();
                switch (rand.Next(2))
                {
                case 0:

                    //System.out.println("Thread: " + thread + " - Depth: " + depth);
                    DEOS.println("Choice 0:");
                    DEOS.println(thread.ToString() + " waiting until next period");
                    DEOSKernel.WaitUntilNextPeriodK(thread);

                    //yieldCPU();
                    break;

                case 2:

                    //System.out.println("Thread: " + thread + " - Depth: " + depth);
                    DEOS.println("Choice 2:");
                    DEOS.println(thread.ToString() + " deleting");
                    int result = DEOSKernel.DeleteThreadK(thread);
                    logger.Info("{threadName}|{result}", thread.ToString(), result);

                    //deleteThread();
                    break;

                case 1:

                    //System.out.println("Thread: " + thread + " - Depth: " + depth);
                    DEOS.println("Choice 1: ");
                    GetInterrupted(tickResult);

                    break;
                }
            }
        }