September 30, 2010 [phobos] escaping FILE's buffering tyranny | ||||
---|---|---|---|---|
| ||||
If you choose the way looking at the actual definition of the FILE structure, consider adding a query interface whether its buffer is empty or not. Then File can support non-blocking I/O to some extent. For example, you can know whether reading from a fd would block by calling select(). But it doesn't know FILE's buffer. This is one of some reasons why Ruby1.9 abandoned the use of C stdio, and why Ruby1.8 had been looking at fields of FILE. Ruby uses user-thread, so non-blocking I/O is important for I/O multiplexing. If anyone want to add non-blocking I/O facilities to phobos, then probably the problem takes place in D's case also. If you choose another way, adding own buffering layer to phobos, there is no problem. Personally I don't like playing with FILE, but I understand the benefits of the compatibility with C. |
Copyright © 1999-2021 by the D Language Foundation