none
why it do not print @ ?

    Question

  • when i debug this program , it do not print @

    how to schedule the task to begin at 11:00 a.m.  , before 11:00 a.m. it do not run, and then next day it will run at 11:00 a.m. again and repeat this next day again and again

    when try the basic timespan, got error

    var token = scheduler.Schedule(TimeSpan.FromTicks(1000), Work); // error after compile

    public static IDisposable Work(IScheduler scheduler, List<int> list)
            {
                var tokenSource = new CancellationTokenSource();
                var cancelToken = tokenSource.Token;
                var task = new Task(() =>
                {
                    Console.WriteLine();
                    while(true)
                    {
                        //var sw = new SpinWait();
                        //for (int j = 0; j < 3000; j++) sw.SpinOnce();
                        Console.Write("@");
                        //list.Add(i);
                        if (cancelToken.IsCancellationRequested)
                        {
                            Console.WriteLine("Cancelation requested");
                            //cancelToken.ThrowIfCancellationRequested();
                            return;
                        }
                    }
                }, cancelToken);
                task.Start();
                return Disposable.Create(tokenSource.Cancel);
            }
    
    
    var scheduler = new TestScheduler();
                var list = new List<int>();
                Console.WriteLine("Enter to quit:");
                var token = scheduler.Schedule(list, Work);
                Console.ReadLine();
                Console.WriteLine("Cancelling...");
                token.Dispose();
                Console.WriteLine("Cancelled");

    Friday, February 14, 2014 8:36 AM