コード例 #1
0
        public async Task TestAsyncDeadlock()
        {
            AsyncCache <int, int> cache     = new AsyncCache <int, int>();
            Stopwatch             stopwatch = new Stopwatch();

            stopwatch.Start();
            await Task.Factory.StartNew(() =>
            {
                stopwatch.Stop();
                Logger.LogLine($"TestAsyncDeadlock Factory started in {stopwatch.ElapsedMilliseconds} ms");
                cache.Set(0, 42);
            },
                                        CancellationToken.None,
                                        TaskCreationOptions.None,
                                        new SingleTaskScheduler()
                                        );
        }
コード例 #2
0
        public async Task TestAsyncDeadlock()
        {
            AsyncCache <int, int> cache = new AsyncCache <int, int>();

            await Task.Factory.StartNew(() => cache.Set(0, 42), CancellationToken.None, TaskCreationOptions.None, new SingleTaskScheduler());
        }