ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/IO-AIO/AIO.xs
(Generate patch)

Comparing IO-AIO/AIO.xs (file contents):
Revision 1.51 by root, Sun Oct 22 22:14:33 2006 UTC vs.
Revision 1.53 by root, Mon Oct 23 00:17:07 2006 UTC

118 return sv_2mortal (sv_bless (newRV_inc (req->self), gv_stashpv (klass, 1))); 118 return sv_2mortal (sv_bless (newRV_inc (req->self), gv_stashpv (klass, 1)));
119} 119}
120 120
121static aio_req SvAIO_REQ (SV *sv) 121static aio_req SvAIO_REQ (SV *sv)
122{ 122{
123 MAGIC *mg;
124
123 if (!sv_derived_from (sv, AIO_REQ_KLASS) || !SvROK (sv)) 125 if (!sv_derived_from (sv, AIO_REQ_KLASS) || !SvROK (sv))
124 croak ("object of class " AIO_REQ_KLASS " expected"); 126 croak ("object of class " AIO_REQ_KLASS " expected");
125 127
126 MAGIC *mg = mg_find (SvRV (sv), PERL_MAGIC_ext); 128 mg = mg_find (SvRV (sv), PERL_MAGIC_ext);
127 129
128 return mg ? (aio_req)mg->mg_ptr : 0; 130 return mg ? (aio_req)mg->mg_ptr : 0;
129} 131}
130 132
131static void aio_grp_feed (aio_req grp) 133static void aio_grp_feed (aio_req grp)
832 834
833 pthread_mutex_lock (&reslock); 835 pthread_mutex_lock (&reslock);
834 836
835 req->next = 0; 837 req->next = 0;
836 838
837 printf ("queue rese %p\n", rese);//D
838 if (rese) 839 if (rese)
839 { 840 {
840 rese->next = req; 841 rese->next = req;
841 rese = req; 842 rese = req;
842 } 843 }
1278void 1279void
1279add (aio_req grp, ...) 1280add (aio_req grp, ...)
1280 PPCODE: 1281 PPCODE:
1281{ 1282{
1282 int i; 1283 int i;
1284 aio_req req;
1283 1285
1284 if (grp->fd == 2) 1286 if (grp->fd == 2)
1285 croak ("cannot add requests to IO::AIO::GRP after the group finished"); 1287 croak ("cannot add requests to IO::AIO::GRP after the group finished");
1286 1288
1287 for (i = 1; i < items; ++i ) 1289 for (i = 1; i < items; ++i )
1288 { 1290 {
1289 if (GIMME_V != G_VOID) 1291 if (GIMME_V != G_VOID)
1290 XPUSHs (sv_2mortal (newSVsv (ST (i)))); 1292 XPUSHs (sv_2mortal (newSVsv (ST (i))));
1291 1293
1292 aio_req req = SvAIO_REQ (ST (i)); 1294 req = SvAIO_REQ (ST (i));
1293 1295
1294 if (req) 1296 if (req)
1295 { 1297 {
1296 ++grp->length; 1298 ++grp->length;
1297 req->grp = grp; 1299 req->grp = grp;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines