
On Sun, 19 Aug 2012 12:46:12 +0200, Klaim - Joël Lamotte <mjklaim@gmail.com> wrote:
[...]Also as pointed by others, it goes agains RAII based design to force the user to explicitely release resources.
I don't think of the child class has a RAII type (but I see how this made you propose a non-copyable class). It could be a RAII type on Windows as the process and thread handles (which are member variables of the class) have to be closed. But it wouldn't work on POSIX as you have to clean up differently. So I treat the child class as a value-based type which works on Windows and POSIX. I'd also prefer a guaranteed cleanup. But it's not clear how to do this with a RAII type on POSIX (unless you have an idea? :).
[...]My first reflex would be to ask why is it two totally different types? Boost.Asio doesn't provide a type that would use the platform-specific type in it's implementation?
Unfortunately not. For asynchronous read/write operations posix::stream_descriptor and windows::stream_handle could maybe be merged into a class which could be initialized with a boost::iostreams::file_descriptor_sink or boost::iostreams::file_descriptor_source. These classes wrap a file descriptor and a Windows HANDLE already nicely. So it might be possible to put something together. Boris
[...]