On 2013-12-01 02:34, Sönke Ludwig wrote:

Am 01.12.2013 04:14, schrieb Etienne:

I'm writing a Lua D adaptation for Vibe.d to add scripting support. When
requesting data from HDD using loadFrom(path), would there be a function
that yields during a HDD request?

Do you mean loadfile as used for loading a script? In that case I'd
simply ignore HDD I/O as the file size should be small enough for I/O
not to really matter. If it's about loading data from disk from inside a
LUA script, you'd probably have to register your own function for
loading the contents and skip loading the one from the LUA standard
library (or unregister/overwrite it)*.

I saw posix has aioread(&cbAio) and windows has FILEFLAGOVERLAPPED
for async HDD file reading. It might be quite easy to overload the
std.file.read functions for yielding in the future, I know my
application will be receiving lots of huge files that need to be parsed
into a database with vibe.d, so anything above the likely 200MB/s of HDD
load could easily block the application entirely, it'll have to be
delegated to the kernel until it's inside a buffer. Using vibe.d,
aio
read and FILEFLAGOVERLAPPED seems like the easy way out for me.

I'm wondering though, do you see any complications coming up with this idea?