示例#1
0
        public async Task WriteAsync(string cad, InputOutputMutex action = InputOutputMutex.None)
        {
            if (action.IsWaitable())
            {
                _mutex.WaitOne();
            }

            await Output.WriteAsync(cad);

            if (action.IsReleasable())
            {
                _mutex.ReleaseMutex();
            }
        }
示例#2
0
        public void Write(string cad, InputOutputMutex action = InputOutputMutex.None)
        {
            if (action.IsWaitable())
            {
                _mutex.WaitOne();
            }

            Output.Write(cad);

            if (action.IsReleasable())
            {
                _mutex.ReleaseMutex();
            }
        }
示例#3
0
        public async Task <string> ReadLineAsync(InputOutputMutex action = InputOutputMutex.None)
        {
            if (action.IsWaitable())
            {
                _mutex.WaitOne();
            }

            var line = await Input.ReadLineAsync();

            if (action.IsReleasable())
            {
                _mutex.ReleaseMutex();
            }

            return(line);
        }
示例#4
0
        public string ReadLine(InputOutputMutex action = InputOutputMutex.None)
        {
            if (action.IsWaitable())
            {
                _mutex.WaitOne();
            }

            var line = Input.ReadLine();

            if (action.IsReleasable())
            {
                _mutex.ReleaseMutex();
            }

            return(line);
        }