Am 08.11.2017 um 19:33 schrieb Dietmar Maurer:
On Wed, 08 Nov 2017 17:22:46 GMT, Sönke Ludwig wrote:
On Wed, 8 Nov 2017 18:14:14 +0100, Sönke Ludwig wrote:
But as far as I know, libevent also uses a thread pool for
file I/O.Correction: libevent does not support file I/O at all. I was thinking about libuv here.
With libevent, you open the file with O_NOBLOCK, and then use poll/select to wait until it gets a readable/writable event. Then you can do the non blocking read-write. It is quite easy to use/implement that using your current libevent2 D bindings.
int fd = open(..., O_NOBLOCK ...) FileDescriptorEvent ev = createFileDescriptorEvent(out_fd, FileDescriptorEvent.Trigger.read, FileDescriptorEvent.Mode.persistent); ev.wait(); read(...)
This is not 100% reliable (may block in some cases), but works quite well in practice.
What benchmark do you use to test the new threadedfile implementation? I would like to compare with a correct libevent based implementation.
Files don't support non-blocking operation, they will always be flagged
as ready for read/write. This will work, but always blocks. There are
some "files" that are actually sockets or pipes for which this will in
fact work, but not for regular files.