lkml.org 
[lkml]   [1997]   [May]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: Q for the standards gurus...
Date
> 	iodone(char *buf, int len, int retval)
> {
> if (retval == -1) {
> fprintf(stderr, "I/O on buffer %x for %d failed: %d\n",
> buf, len, retval);
> } else if (retval < len) {
> fprintf(stderr, "I/O on buffer %x wanted %d got %d\n",
> buf, len, retval);
> } /* else success */
> free(buf);
> }
>
> char *buf = valloc(SIZE);
>
> reada(fd, buf, SIZE, iodone);
>
> /* do some other useful work */
>
> Is that what you meant?

I'm fairly sure that's what he meant -- at least that's what I
read out of it too. (Though I would also pass along a void* for
the callback routine so that it can avoid searching for some struct,
and retval would be -ERROR as usual.)

The thing that has always bothered me about the threaded userland
approach is that the new thread requires a stack. With this
approach, we consume minimal resources as well as already being in
the right place to issue the signal for the i/o completion.

Anyway, it got me thinking enough to actually start on posix.4
signals (yeah, my book is a bit behind ;-), so that those would
be ready for whichever method is used for aio.


r~

\
 
 \ /
  Last update: 2005-03-22 13:39    [W:0.032 / U:1.132 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site