… | |
… | |
707 | =head4 GROUP REQUEST LIFETIME |
707 | =head4 GROUP REQUEST LIFETIME |
708 | |
708 | |
709 | Left alone, a group request will instantly move to the pending state and |
709 | Left alone, a group request will instantly move to the pending state and |
710 | will be finished at the next call of C<eio_poll>. |
710 | will be finished at the next call of C<eio_poll>. |
711 | |
711 | |
712 | There usefulness stems from the fact that, if a subrequest is added to a |
712 | The usefulness stems from the fact that, if a subrequest is added to a |
713 | group I<before> a call to C<eio_poll>, via C<eio_grp_add>, then the group |
713 | group I<before> a call to C<eio_poll>, via C<eio_grp_add>, then the group |
714 | will not finish until all the subrequests have finished. |
714 | will not finish until all the subrequests have finished. |
715 | |
715 | |
716 | So the usage cycle of a group request is like this: after it is created, |
716 | So the usage cycle of a group request is like this: after it is created, |
717 | you normally instantly add a subrequest. If none is added, the group |
717 | you normally instantly add a subrequest. If none is added, the group |
… | |
… | |
738 | can return as "the load request". |
738 | can return as "the load request". |
739 | |
739 | |
740 | =item 2) open the file, maybe |
740 | =item 2) open the file, maybe |
741 | |
741 | |
742 | Next, open the file with C<eio_open> and add the request to the group |
742 | Next, open the file with C<eio_open> and add the request to the group |
743 | request and you are finished steting up the request. |
743 | request and you are finished setting up the request. |
744 | |
744 | |
745 | If, for some reason, you cannot C<eio_open> (path is a null ptr?) you |
745 | If, for some reason, you cannot C<eio_open> (path is a null ptr?) you |
746 | cna set C<< grp->result >> to C<-1> to signal an error and let the gorup |
746 | can set C<< grp->result >> to C<-1> to signal an error and let the group |
747 | request finish on its own. |
747 | request finish on its own. |
748 | |
748 | |
749 | =item 3) open callback adds more requests |
749 | =item 3) open callback adds more requests |
750 | |
750 | |
751 | In the open callback, if the open was not successful, copy C<< |
751 | In the open callback, if the open was not successful, copy C<< |
… | |
… | |
753 | C<-1> to signal an error. |
753 | C<-1> to signal an error. |
754 | |
754 | |
755 | Otherwise, malloc some memory or so and issue a read request, adding the |
755 | Otherwise, malloc some memory or so and issue a read request, adding the |
756 | read request to the group. |
756 | read request to the group. |
757 | |
757 | |
758 | =item 4) continue issuign requests till finished |
758 | =item 4) continue issuing requests till finished |
759 | |
759 | |
760 | In the real callback, check for errors and possibly continue with |
760 | In the real callback, check for errors and possibly continue with |
761 | C<eio_close> or any other eio request in the same way. |
761 | C<eio_close> or any other eio request in the same way. |
762 | |
762 | |
763 | As soon as no new requests are added the group request will finish. Make |
763 | As soon as no new requests are added the group request will finish. Make |