Пример #1
0
        private static async Task Read1Async()
        {
            var path  = new FileInfo("a.md").FullName.Replace(Path.DirectorySeparatorChar, '-');
            var token = $"dotnet-campus-configuration-{path}";

            var queue = new InterprocessQueue <int>(token, 32);
            var item  = DateTime.Now.Second;

            queue.Enqueue(item);
            Console.WriteLine($"入队:{item}");
        }
Пример #2
0
        private static async Task Write1Async()
        {
            var path  = new FileInfo("a.md").FullName.Replace(Path.DirectorySeparatorChar, '-');
            var token = $"dotnet-campus-configuration-{path}";

            var queue = new InterprocessQueue <int>(token, 32);

            if (queue.TryDequeue(out var result))
            {
                Console.WriteLine($"出队:{result}");
            }
            else
            {
                Console.WriteLine($"无事可做");
            }
        }