On Sat, 2007-04-07 at 18:06 +1000, skaller wrote:
> I've run into a problem with Async fileio. On Posix,
> the follwing interface is required:
>
> proc faio_write(q: job_queue,
> fd: fd_t, len: &int, buf: address, eof: &bool
> )
> {
> faio_rw(q, fd, len, buf, eof, false); // write
> }
>
> The 'q' there is a worker_fifo thing.
//
// fd_t -- native file handle (disk file)
//
instance IByteStream[fd_t]
{
proc read(s: fd_t, len: &int, buf: address, eof: &bool)
#if POSIX
{ faio_read(s, len, buf, eof); }
#elif WIN32
{ ReadFile(s, len, buf, eof); }
#endif
}
OK, I see two options here:
A. Modify the stream typeclass so all stream I/O requires
a job_queue argument.
B. Make a new type
afd_t = fd_t * job_queue
Now there are two file types, one for sync I/O and one
for async I/O .. but only for posix lol (since Windows
has no problem with async I/O). Also there's a problem
with memory management of the job_queue.
Solution B locks the file handling into async mode
with a particular queue at time afd_t object is
constructed. So actually you could do this:
read ( (q,fd), ....
Comments?
--
John Skaller <skaller at users dot sf dot net>
Felix, successor to C++: http://felix.sf.net
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Felix-language mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/felix-language