vezel-dev / cathode

A terminal-centric replacement for the .NET console APIs.
https://docs.vezel.dev/cathode
BSD Zero Clause License
91 stars 7 forks source link

Support some notion of exclusive terminal access #52

Closed alexrp closed 2 years ago

alexrp commented 2 years ago

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.

alexrp commented 2 years ago

ReaderWriteLockSlim not working in async methods is throwing a wrench in my approach here...