| * first recvp acquires the ioproc. |
| * second tells us that the data is ready. |
| while(recv(io->c, &x) == -1) |
| if(x == 0) /* our cue to leave */ |
| /* caller is now committed -- even if interrupted he'll return */ |
| while(recv(io->creply, &x) == -1) |
| if(x == 0) /* caller backed out */ |
| io->ret = io->op(&io->arg); |
| rerrstr(io->err, sizeof io->err); |
| while(send(io->creply, &io) == -1) |
| while(recv(io->creply, &x) == -1) |
| io = mallocz(sizeof(*io), 1); |
| sysfatal("ioproc malloc: %r"); |
| io->c = chancreate(sizeof(void*), 0); |
| io->creply = chancreate(sizeof(void*), 0); |
| io->tid = proccreate(xioproc, io, STACK); |
| while(send(io->c, 0) == -1) |