pkg / term

Package term manages POSIX terminals.
BSD 2-Clause "Simplified" License
393 stars 64 forks source link

Use term with epoll #21

Open typeless opened 8 years ago

typeless commented 8 years ago

We have an application which will open multiple serial ports ('real' serial ports like RS232 or USB CDC/ACM ones) simultaneously. It waits for the first arrival byte to decide which port is going to be selected exclusively for further communications. In the old C implementation, it uses non-blocking I/O to check all the open ports in a spinning loop, which is quite inefficient. Therefore, we would like to use epoll(7) to implement the functionality with the serial port APIs provided by the term package. However, the underlying file descriptor managed by Term, which is needed by epoll, is not exposed.

In summary, we need a way to use epoll or the similar to cooperate pkg/term.

Here is the proposed PR #20