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.54 by root, Mon Oct 23 00:34:36 2006 UTC vs.
Revision 1.57 by root, Mon Oct 23 18:38:15 2006 UTC

130 return mg ? (aio_req)mg->mg_ptr : 0; 130 return mg ? (aio_req)mg->mg_ptr : 0;
131} 131}
132 132
133static void aio_grp_feed (aio_req grp) 133static void aio_grp_feed (aio_req grp)
134{ 134{
135 while (grp->length < grp->fd2) 135 while (grp->length < grp->fd2 && !grp->cancelled)
136 { 136 {
137 int old_len = grp->length; 137 int old_len = grp->length;
138 138
139 if (grp->fh2 && SvOK (grp->fh2)) 139 if (grp->fh2 && SvOK (grp->fh2))
140 { 140 {
821 tv.tv_usec = req->fd2; 821 tv.tv_usec = req->fd2;
822 822
823 req->result = select (0, 0, 0, 0, &tv); 823 req->result = select (0, 0, 0, 0, &tv);
824 } 824 }
825 825
826 case REQ_GROUP: /*TODO: should not be handled here */ 826 case REQ_GROUP:
827 case REQ_NOP: /*TODO: should not be handled here */ 827 case REQ_NOP:
828 case REQ_QUIT: 828 case REQ_QUIT:
829 break; 829 break;
830 830
831 default: 831 default:
832 req->result = ENOSYS; 832 req->result = ENOSYS;
1287cancel (aio_req_ornot req) 1287cancel (aio_req_ornot req)
1288 PROTOTYPE: 1288 PROTOTYPE:
1289 CODE: 1289 CODE:
1290 req_cancel (req); 1290 req_cancel (req);
1291 1291
1292void
1293cb (aio_req req, SV *callback=&PL_sv_undef)
1294 CODE:
1295 SvREFCNT_dec (req->callback);
1296 req->callback = newSVsv (callback);
1297
1292MODULE = IO::AIO PACKAGE = IO::AIO::GRP 1298MODULE = IO::AIO PACKAGE = IO::AIO::GRP
1293 1299
1294void 1300void
1295add (aio_req grp, ...) 1301add (aio_req grp, ...)
1296 PPCODE: 1302 PPCODE:
1337 SvREFCNT_dec (grp->data); 1343 SvREFCNT_dec (grp->data);
1338 grp->data = (SV *)av; 1344 grp->data = (SV *)av;
1339} 1345}
1340 1346
1341void 1347void
1342lock (aio_req grp)
1343 CODE:
1344 ++grp->length;
1345
1346void
1347unlock (aio_req grp)
1348 CODE:
1349 aio_grp_dec (grp);
1350
1351void
1352feeder_limit (aio_req grp, int limit) 1348feed_limit (aio_req grp, int limit)
1353 CODE: 1349 CODE:
1354 grp->fd2 = limit; 1350 grp->fd2 = limit;
1355 aio_grp_feed (grp); 1351 aio_grp_feed (grp);
1356 1352
1357void 1353void
1358set_feeder (aio_req grp, SV *callback=&PL_sv_undef) 1354feed (aio_req grp, SV *callback=&PL_sv_undef)
1359 CODE: 1355 CODE:
1360{ 1356{
1361 SvREFCNT_dec (grp->fh2); 1357 SvREFCNT_dec (grp->fh2);
1362 grp->fh2 = newSVsv (callback); 1358 grp->fh2 = newSVsv (callback);
1363 1359

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines