pkg/term

Use term with epoll

typeless opened this issue · 0 comments

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