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

Comparing EV/EV.xs (file contents):
Revision 1.141 by root, Thu Jul 8 00:45:03 2010 UTC vs.
Revision 1.145 by root, Sun Oct 24 19:01:01 2010 UTC

120 *stash_idle, 120 *stash_idle,
121 *stash_prepare, 121 *stash_prepare,
122 *stash_check, 122 *stash_check,
123 *stash_embed, 123 *stash_embed,
124 *stash_fork, 124 *stash_fork,
125 *stash_cleanup,
125 *stash_async; 126 *stash_async;
126 127
127///////////////////////////////////////////////////////////////////////////// 128/////////////////////////////////////////////////////////////////////////////
128// Event 129// Event
129 130
364 const_iv (EV_, UNDEF) 365 const_iv (EV_, UNDEF)
365 const_iv (EV_, NONE) 366 const_iv (EV_, NONE)
366 const_iv (EV_, READ) 367 const_iv (EV_, READ)
367 const_iv (EV_, WRITE) 368 const_iv (EV_, WRITE)
368 const_iv (EV_, IO) 369 const_iv (EV_, IO)
369 const_iv (EV_, TIMEOUT) /* deprecated */
370 const_iv (EV_, TIMER) 370 const_iv (EV_, TIMEOUT)
371 const_iv (EV_, PERIODIC) 371 const_iv (EV_, PERIODIC)
372 const_iv (EV_, SIGNAL) 372 const_iv (EV_, SIGNAL)
373 const_iv (EV_, CHILD) 373 const_iv (EV_, CHILD)
374 const_iv (EV_, STAT) 374 const_iv (EV_, STAT)
375 const_iv (EV_, IDLE) 375 const_iv (EV_, IDLE)
376 const_iv (EV_, PREPARE) 376 const_iv (EV_, PREPARE)
377 const_iv (EV_, CHECK) 377 const_iv (EV_, CHECK)
378 const_iv (EV_, EMBED) 378 const_iv (EV_, EMBED)
379 const_iv (EV_, FORK) 379 const_iv (EV_, FORK)
380 const_iv (EV_, CLEANUP)
380 const_iv (EV_, ASYNC) 381 const_iv (EV_, ASYNC)
381 const_iv (EV_, CUSTOM) 382 const_iv (EV_, CUSTOM)
382 const_iv (EV_, ERROR) 383 const_iv (EV_, ERROR)
383 384
384 const_iv (EV, LOOP_NONBLOCK)
385 const_iv (EV, LOOP_ONESHOT)
386
387 const_iv (EV, UNLOOP_CANCEL) 385 const_iv (EV, RUN_NOWAIT)
388 const_iv (EV, UNLOOP_ONE) 386 const_iv (EV, RUN_ONCE)
387
388 const_iv (EV, BREAK_CANCEL)
389 const_iv (EV, BREAK_ONE)
389 const_iv (EV, UNLOOP_ALL) 390 const_iv (EV, BREAK_ALL)
390
391 const_iv (EV, BACKEND_SELECT) 391 const_iv (EV, BACKEND_SELECT)
392 const_iv (EV, BACKEND_POLL) 392 const_iv (EV, BACKEND_POLL)
393 const_iv (EV, BACKEND_EPOLL) 393 const_iv (EV, BACKEND_EPOLL)
394 const_iv (EV, BACKEND_KQUEUE) 394 const_iv (EV, BACKEND_KQUEUE)
395 const_iv (EV, BACKEND_DEVPOLL) 395 const_iv (EV, BACKEND_DEVPOLL)
402 const_iv (EV, FLAG_NOSIGFD) /* compatibility, always 0 */ 402 const_iv (EV, FLAG_NOSIGFD) /* compatibility, always 0 */
403 const_iv (EV, FLAG_NOINOTIFY) 403 const_iv (EV, FLAG_NOINOTIFY)
404 404
405 const_iv (EV_, VERSION_MAJOR) 405 const_iv (EV_, VERSION_MAJOR)
406 const_iv (EV_, VERSION_MINOR) 406 const_iv (EV_, VERSION_MINOR)
407#if EV_COMPAT3
408 const_iv (EV_, TIMER)
409
410 const_iv (EV, LOOP_NONBLOCK)
411 const_iv (EV, LOOP_ONESHOT)
412
413 const_iv (EV, UNLOOP_CANCEL)
414 const_iv (EV, UNLOOP_ONE)
415 const_iv (EV, UNLOOP_ALL)
416#endif
407 }; 417 };
408 418
409 for (civ = const_iv + sizeof (const_iv) / sizeof (const_iv [0]); civ-- > const_iv; ) 419 for (civ = const_iv + sizeof (const_iv) / sizeof (const_iv [0]); civ-- > const_iv; )
410 newCONSTSUB (stash, (char *)civ->name, newSViv (civ->iv)); 420 newCONSTSUB (stash, (char *)civ->name, newSViv (civ->iv));
411 421
420 stash_check = gv_stashpv ("EV::Check" , 1); 430 stash_check = gv_stashpv ("EV::Check" , 1);
421 stash_child = gv_stashpv ("EV::Child" , 1); 431 stash_child = gv_stashpv ("EV::Child" , 1);
422 stash_embed = gv_stashpv ("EV::Embed" , 1); 432 stash_embed = gv_stashpv ("EV::Embed" , 1);
423 stash_stat = gv_stashpv ("EV::Stat" , 1); 433 stash_stat = gv_stashpv ("EV::Stat" , 1);
424 stash_fork = gv_stashpv ("EV::Fork" , 1); 434 stash_fork = gv_stashpv ("EV::Fork" , 1);
435 stash_cleanup = gv_stashpv ("EV::Cleanup" , 1);
425 stash_async = gv_stashpv ("EV::Async" , 1); 436 stash_async = gv_stashpv ("EV::Async" , 1);
426 437
427 { 438 {
428 SV *sv = perl_get_sv ("EV::API", TRUE); 439 SV *sv = perl_get_sv ("EV::API", TRUE);
429 perl_get_sv ("EV::API", TRUE); /* silence 5.10 warning */ 440 perl_get_sv ("EV::API", TRUE); /* silence 5.10 warning */
448 evapi.now = ev_now; 459 evapi.now = ev_now;
449 evapi.now_update = ev_now_update; 460 evapi.now_update = ev_now_update;
450 evapi.suspend = ev_suspend; 461 evapi.suspend = ev_suspend;
451 evapi.resume = ev_resume; 462 evapi.resume = ev_resume;
452 evapi.backend = ev_backend; 463 evapi.backend = ev_backend;
453 evapi.unloop = ev_unloop; 464 evapi.break_ = ev_break;
454 evapi.invoke_pending = ev_invoke_pending; 465 evapi.invoke_pending = ev_invoke_pending;
455 evapi.pending_count = ev_pending_count; 466 evapi.pending_count = ev_pending_count;
456 evapi.verify = ev_verify; 467 evapi.verify = ev_verify;
457 evapi.set_loop_release_cb = ev_set_loop_release_cb; 468 evapi.set_loop_release_cb = ev_set_loop_release_cb;
458 evapi.set_invoke_pending_cb= ev_set_invoke_pending_cb; 469 evapi.set_invoke_pending_cb= ev_set_invoke_pending_cb;
459 evapi.ref = ev_ref; 470 evapi.ref = ev_ref;
460 evapi.unref = ev_unref; 471 evapi.unref = ev_unref;
461 evapi.loop = ev_loop; 472 evapi.run = ev_run;
462 evapi.once = ev_once; 473 evapi.once = ev_once;
463 evapi.io_start = ev_io_start; 474 evapi.io_start = ev_io_start;
464 evapi.io_stop = ev_io_stop; 475 evapi.io_stop = ev_io_stop;
465 evapi.timer_start = ev_timer_start; 476 evapi.timer_start = ev_timer_start;
466 evapi.timer_stop = ev_timer_stop; 477 evapi.timer_stop = ev_timer_stop;
486 evapi.embed_start = ev_embed_start; 497 evapi.embed_start = ev_embed_start;
487 evapi.embed_stop = ev_embed_stop; 498 evapi.embed_stop = ev_embed_stop;
488 evapi.embed_sweep = ev_embed_sweep; 499 evapi.embed_sweep = ev_embed_sweep;
489 evapi.fork_start = ev_fork_start; 500 evapi.fork_start = ev_fork_start;
490 evapi.fork_stop = ev_fork_stop; 501 evapi.fork_stop = ev_fork_stop;
502 evapi.cleanup_start = ev_cleanup_start;
503 evapi.cleanup_stop = ev_cleanup_stop;
491 evapi.async_start = ev_async_start; 504 evapi.async_start = ev_async_start;
492 evapi.async_stop = ev_async_stop; 505 evapi.async_stop = ev_async_stop;
493 evapi.async_send = ev_async_send; 506 evapi.async_send = ev_async_send;
494 evapi.clear_pending = ev_clear_pending; 507 evapi.clear_pending = ev_clear_pending;
495 evapi.invoke = ev_invoke; 508 evapi.invoke = ev_invoke;
520 OUTPUT: 533 OUTPUT:
521 RETVAL 534 RETVAL
522 535
523void ev_default_destroy () 536void ev_default_destroy ()
524 CODE: 537 CODE:
525 ev_default_destroy (); 538 ev_loop_destroy (EV_DEFAULT_UC);
526 SvREFCNT_dec (default_loop_sv); 539 SvREFCNT_dec (default_loop_sv);
527 default_loop_sv = 0; 540 default_loop_sv = 0;
528 541
529unsigned int ev_supported_backends () 542unsigned int ev_supported_backends ()
530 543
550 563
551unsigned int ev_backend () 564unsigned int ev_backend ()
552 C_ARGS: evapi.default_loop 565 C_ARGS: evapi.default_loop
553 566
554void ev_verify () 567void ev_verify ()
568 ALIAS:
569 loop_verify = 1
555 C_ARGS: evapi.default_loop 570 C_ARGS: evapi.default_loop
556 571
557unsigned int ev_iteration () 572unsigned int ev_iteration ()
573 ALIAS:
574 loop_count = 1
558 C_ARGS: evapi.default_loop 575 C_ARGS: evapi.default_loop
559 576
560unsigned int ev_depth () 577unsigned int ev_depth ()
578 ALIAS:
579 loop_depth = 1
561 C_ARGS: evapi.default_loop 580 C_ARGS: evapi.default_loop
562 581
563void ev_set_io_collect_interval (NV interval) 582void ev_set_io_collect_interval (NV interval)
564 C_ARGS: evapi.default_loop, interval 583 C_ARGS: evapi.default_loop, interval
565 584
566void ev_set_timeout_collect_interval (NV interval) 585void ev_set_timeout_collect_interval (NV interval)
567 C_ARGS: evapi.default_loop, interval 586 C_ARGS: evapi.default_loop, interval
568 587
569void ev_loop (int flags = 0) 588void ev_run (int flags = 0)
589 ALIAS:
590 loop = 1
570 C_ARGS: evapi.default_loop, flags 591 C_ARGS: evapi.default_loop, flags
571 592
572void ev_unloop (int how = EVUNLOOP_ONE) 593void ev_break (int how = EVBREAK_ONE)
594 ALIAS:
595 unloop = 1
573 C_ARGS: evapi.default_loop, how 596 C_ARGS: evapi.default_loop, how
574 597
575void ev_feed_fd_event (int fd, int revents = EV_NONE) 598void ev_feed_fd_event (int fd, int revents = EV_NONE)
576 C_ARGS: evapi.default_loop, fd, revents 599 C_ARGS: evapi.default_loop, fd, revents
577 600
695 ev_fork_set (RETVAL); 718 ev_fork_set (RETVAL);
696 if (!ix) START (fork, RETVAL); 719 if (!ix) START (fork, RETVAL);
697 OUTPUT: 720 OUTPUT:
698 RETVAL 721 RETVAL
699 722
723ev_cleanup *cleanup (SV *cb)
724 ALIAS:
725 cleanup_ns = 1
726 CODE:
727 RETVAL = e_new (sizeof (ev_cleanup), cb, default_loop_sv);
728 ev_cleanup_set (RETVAL);
729 if (!ix) START (cleanup, RETVAL);
730 OUTPUT:
731 RETVAL
700 732
701ev_child *child (int pid, int trace, SV *cb) 733ev_child *child (int pid, int trace, SV *cb)
702 ALIAS: 734 ALIAS:
703 child_ns = 1 735 child_ns = 1
704 CODE: 736 CODE:
1083 STOP (fork, w); 1115 STOP (fork, w);
1084 1116
1085void DESTROY (ev_fork *w) 1117void DESTROY (ev_fork *w)
1086 CODE: 1118 CODE:
1087 STOP (fork, w); 1119 STOP (fork, w);
1120 e_destroy (w);
1121
1122MODULE = EV PACKAGE = EV::Cleanup PREFIX = ev_cleanup_
1123
1124void ev_cleanup_start (ev_cleanup *w)
1125 CODE:
1126 START (cleanup, w);
1127
1128void ev_cleanup_stop (ev_cleanup *w)
1129 CODE:
1130 STOP (cleanup, w);
1131
1132void DESTROY (ev_cleanup *w)
1133 CODE:
1134 STOP (cleanup, w);
1088 e_destroy (w); 1135 e_destroy (w);
1089 1136
1090MODULE = EV PACKAGE = EV::Child PREFIX = ev_child_ 1137MODULE = EV PACKAGE = EV::Child PREFIX = ev_child_
1091 1138
1092#if EV_CHILD_ENABLE 1139#if EV_CHILD_ENABLE
1285 OUTPUT: 1332 OUTPUT:
1286 RETVAL 1333 RETVAL
1287 1334
1288void DESTROY (struct ev_loop *loop) 1335void DESTROY (struct ev_loop *loop)
1289 CODE: 1336 CODE:
1290 if (loop != evapi.default_loop) /* global destruction sucks */ 1337 /* 1. the default loop shouldn't be freed by destroying it'S pelr loop object */
1338 /* 2. not doing so helps avoid many global destruction bugs in perl, too */
1339 if (loop != evapi.default_loop)
1291 ev_loop_destroy (loop); 1340 ev_loop_destroy (loop);
1292 1341
1293void ev_loop_fork (struct ev_loop *loop) 1342void ev_loop_fork (struct ev_loop *loop)
1294 1343
1344NV ev_now (struct ev_loop *loop)
1345
1346void ev_now_update (struct ev_loop *loop)
1347
1348void ev_suspend (struct ev_loop *loop)
1349
1350void ev_resume (struct ev_loop *loop)
1351
1352void ev_set_io_collect_interval (struct ev_loop *loop, NV interval)
1353
1354void ev_set_timeout_collect_interval (struct ev_loop *loop, NV interval)
1355
1356unsigned int ev_backend (struct ev_loop *loop)
1357
1295void ev_verify (struct ev_loop *loop) 1358void ev_verify (struct ev_loop *loop)
1296 1359 ALIAS:
1297NV ev_now (struct ev_loop *loop) 1360 loop_verify = 1
1298
1299void ev_now_update (struct ev_loop *loop)
1300
1301void ev_suspend (struct ev_loop *loop)
1302
1303void ev_resume (struct ev_loop *loop)
1304
1305void ev_set_io_collect_interval (struct ev_loop *loop, NV interval)
1306
1307void ev_set_timeout_collect_interval (struct ev_loop *loop, NV interval)
1308
1309unsigned int ev_backend (struct ev_loop *loop)
1310 1361
1311unsigned int ev_iteration (struct ev_loop *loop) 1362unsigned int ev_iteration (struct ev_loop *loop)
1363 ALIAS:
1364 loop_count = 1
1312 1365
1313unsigned int ev_depth (struct ev_loop *loop) 1366unsigned int ev_depth (struct ev_loop *loop)
1367 ALIAS:
1368 loop_depth = 1
1314 1369
1315void ev_loop (struct ev_loop *loop, int flags = 0) 1370void ev_run (struct ev_loop *loop, int flags = 0)
1371 ALIAS:
1372 loop = 1
1316 1373
1317void ev_unloop (struct ev_loop *loop, int how = 1) 1374void ev_break (struct ev_loop *loop, int how = 1)
1375 ALIAS:
1376 unloop = 1
1318 1377
1319void ev_feed_fd_event (struct ev_loop *loop, int fd, int revents = EV_NONE) 1378void ev_feed_fd_event (struct ev_loop *loop, int fd, int revents = EV_NONE)
1320 1379
1321unsigned int ev_pending_count (struct ev_loop *loop) 1380unsigned int ev_pending_count (struct ev_loop *loop)
1322 1381
1433 ev_fork_set (RETVAL); 1492 ev_fork_set (RETVAL);
1434 if (!ix) START (fork, RETVAL); 1493 if (!ix) START (fork, RETVAL);
1435 OUTPUT: 1494 OUTPUT:
1436 RETVAL 1495 RETVAL
1437 1496
1497ev_cleanup *cleanup (struct ev_loop *loop, SV *cb)
1498 ALIAS:
1499 cleanup_ns = 1
1500 CODE:
1501 RETVAL = e_new (sizeof (ev_cleanup), cb, ST (0));
1502 ev_cleanup_set (RETVAL);
1503 if (!ix) START (cleanup, RETVAL);
1504 OUTPUT:
1505 RETVAL
1438 1506
1439ev_child *child (struct ev_loop *loop, int pid, int trace, SV *cb) 1507ev_child *child (struct ev_loop *loop, int pid, int trace, SV *cb)
1440 ALIAS: 1508 ALIAS:
1441 child_ns = 1 1509 child_ns = 1
1442 CODE: 1510 CODE:

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines