Path: utzoo!attcan!uunet!ficc!peter From: peter@ficc.uu.net (Peter da Silva) Newsgroups: comp.os.misc Subject: Re: Asynchronous I/O (was generalized bigotry) Message-ID: <2851@ficc.uu.net> Date: 23 Jan 89 16:39:01 GMT References: <19@xenlink.UUCP> <225800108@uxe.cso.uiuc.edu> <2075@scolex> <7304@venera.isi.edu> Organization: Xenix Support Lines: 41 In article <7304@venera.isi.edu>, raveling@vaxb.isi.edu (Paul Raveling) writes: > In article <2766@ficc.uu.net> peter@ficc.uu.net (Peter da Silva) writes: > >Perhaps a standard set of real-time calls can be decided on. A set more > >suited to a wider variety of operating systems. Something like: > > token = start_read(fd, buffer, nbytes, timeout); ... > > nread = check_io(token); ... > > nread = wait_io(token); > Here's a C rendition of what we did in several systems > starting in 1972 that directly addresses this; I'd still > recommend something like: > ARead (file, &buffer, nbytes, READ_EVENT_ID); > SetTimer (timeout, TIMEOUT_EVENT_ID); I like it too. Silly me. Of course you want to do it this way. One thing, though... passing structures around isn't so cool. And some way of allocating an event flag dynamically (so you can use this stuff in libs) is useful. In AmigaDOS you call AllocSignal(MASK) to do this, but it's more UNIXy to use a file descriptor, or habe the call return the event flag... revent = aread(fd, buffer, nbytes); tevent = asleep(timeout); mask = await(revent|tevent); if(!(mask & revent)) akill(revent); akill(tevent); nread = astatus(revent); And, what's more, you have the kernel of a better error handling setup than perror... -- Peter da Silva, Xenix Support, Ferranti International Controls Corporation. Work: uunet.uu.net!ficc!peter, peter@ficc.uu.net, +1 713 274 5180. `-_-' Home: bigtex!texbell!sugar!peter, peter@sugar.uu.net. 'U` Opinions may not represent the policies of FICC or the Xenix Support group.