For input processing scenarios, one might either subscribe to TerminalReader.InputRead or call TerminalReader.ReadBuffer directly. The latter will have higher overhead, especially if the event handler needs to fire off a task to prevent blocking. The former will have lower overhead but will essentially take over standard input. (Both are valid options.)
For the latter case, we need a way to formalize the exclusive access to the terminal such that anyone else attempting to access it will get an exception.
For input processing scenarios, one might either subscribe to
TerminalReader.InputRead
or callTerminalReader.ReadBuffer
directly. The latter will have higher overhead, especially if the event handler needs to fire off a task to prevent blocking. The former will have lower overhead but will essentially take over standard input. (Both are valid options.)For the latter case, we need a way to formalize the exclusive access to the terminal such that anyone else attempting to access it will get an exception.