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

Comparing EV/EV.xs (file contents):
Revision 1.140 by root, Thu Apr 22 11:25:43 2010 UTC vs.
Revision 1.143 by root, Sat Oct 23 22:25:44 2010 UTC

29# define fd_mask Perl_fd_mask 29# define fd_mask Perl_fd_mask
30#endif 30#endif
31/* due to bugs in OS X we have to use libev/ explicitly here */ 31/* due to bugs in OS X we have to use libev/ explicitly here */
32#include "libev/ev.c" 32#include "libev/ev.c"
33 33
34#ifndef _WIN32 34#if !defined(_WIN32) && !defined(_MINIX)
35# include <pthread.h> 35# include <pthread.h>
36#endif 36#endif
37 37
38#define e_loop(w) INT2PTR (struct ev_loop *, SvIVX (((ev_watcher *)(w))->loop)) 38#define e_loop(w) INT2PTR (struct ev_loop *, SvIVX (((ev_watcher *)(w))->loop))
39#define e_flags(w) ((ev_watcher *)(w))->e_flags 39#define e_flags(w) ((ev_watcher *)(w))->e_flags
364 const_iv (EV_, UNDEF) 364 const_iv (EV_, UNDEF)
365 const_iv (EV_, NONE) 365 const_iv (EV_, NONE)
366 const_iv (EV_, READ) 366 const_iv (EV_, READ)
367 const_iv (EV_, WRITE) 367 const_iv (EV_, WRITE)
368 const_iv (EV_, IO) 368 const_iv (EV_, IO)
369 const_iv (EV_, TIMEOUT) /* deprecated */
370 const_iv (EV_, TIMER) 369 const_iv (EV_, TIMEOUT)
371 const_iv (EV_, PERIODIC) 370 const_iv (EV_, PERIODIC)
372 const_iv (EV_, SIGNAL) 371 const_iv (EV_, SIGNAL)
373 const_iv (EV_, CHILD) 372 const_iv (EV_, CHILD)
374 const_iv (EV_, STAT) 373 const_iv (EV_, STAT)
375 const_iv (EV_, IDLE) 374 const_iv (EV_, IDLE)
379 const_iv (EV_, FORK) 378 const_iv (EV_, FORK)
380 const_iv (EV_, ASYNC) 379 const_iv (EV_, ASYNC)
381 const_iv (EV_, CUSTOM) 380 const_iv (EV_, CUSTOM)
382 const_iv (EV_, ERROR) 381 const_iv (EV_, ERROR)
383 382
384 const_iv (EV, LOOP_NONBLOCK)
385 const_iv (EV, LOOP_ONESHOT)
386
387 const_iv (EV, UNLOOP_CANCEL) 383 const_iv (EV, RUN_NOWAIT)
388 const_iv (EV, UNLOOP_ONE) 384 const_iv (EV, RUN_ONCE)
385
386 const_iv (EV, BREAK_CANCEL)
387 const_iv (EV, BREAK_ONE)
389 const_iv (EV, UNLOOP_ALL) 388 const_iv (EV, BREAK_ALL)
390
391 const_iv (EV, BACKEND_SELECT) 389 const_iv (EV, BACKEND_SELECT)
392 const_iv (EV, BACKEND_POLL) 390 const_iv (EV, BACKEND_POLL)
393 const_iv (EV, BACKEND_EPOLL) 391 const_iv (EV, BACKEND_EPOLL)
394 const_iv (EV, BACKEND_KQUEUE) 392 const_iv (EV, BACKEND_KQUEUE)
395 const_iv (EV, BACKEND_DEVPOLL) 393 const_iv (EV, BACKEND_DEVPOLL)
402 const_iv (EV, FLAG_NOSIGFD) /* compatibility, always 0 */ 400 const_iv (EV, FLAG_NOSIGFD) /* compatibility, always 0 */
403 const_iv (EV, FLAG_NOINOTIFY) 401 const_iv (EV, FLAG_NOINOTIFY)
404 402
405 const_iv (EV_, VERSION_MAJOR) 403 const_iv (EV_, VERSION_MAJOR)
406 const_iv (EV_, VERSION_MINOR) 404 const_iv (EV_, VERSION_MINOR)
405#if EV_COMPAT3
406 const_iv (EV_, TIMER)
407
408 const_iv (EV, LOOP_NONBLOCK)
409 const_iv (EV, LOOP_ONESHOT)
410
411 const_iv (EV, UNLOOP_CANCEL)
412 const_iv (EV, UNLOOP_ONE)
413 const_iv (EV, UNLOOP_ALL)
414#endif
407 }; 415 };
408 416
409 for (civ = const_iv + sizeof (const_iv) / sizeof (const_iv [0]); civ-- > const_iv; ) 417 for (civ = const_iv + sizeof (const_iv) / sizeof (const_iv [0]); civ-- > const_iv; )
410 newCONSTSUB (stash, (char *)civ->name, newSViv (civ->iv)); 418 newCONSTSUB (stash, (char *)civ->name, newSViv (civ->iv));
411 419
448 evapi.now = ev_now; 456 evapi.now = ev_now;
449 evapi.now_update = ev_now_update; 457 evapi.now_update = ev_now_update;
450 evapi.suspend = ev_suspend; 458 evapi.suspend = ev_suspend;
451 evapi.resume = ev_resume; 459 evapi.resume = ev_resume;
452 evapi.backend = ev_backend; 460 evapi.backend = ev_backend;
453 evapi.unloop = ev_unloop; 461 evapi.break_ = ev_break;
454 evapi.invoke_pending = ev_invoke_pending; 462 evapi.invoke_pending = ev_invoke_pending;
455 evapi.pending_count = ev_pending_count; 463 evapi.pending_count = ev_pending_count;
456 evapi.verify = ev_verify; 464 evapi.verify = ev_verify;
457 evapi.set_loop_release_cb = ev_set_loop_release_cb; 465 evapi.set_loop_release_cb = ev_set_loop_release_cb;
458 evapi.set_invoke_pending_cb= ev_set_invoke_pending_cb; 466 evapi.set_invoke_pending_cb= ev_set_invoke_pending_cb;
459 evapi.ref = ev_ref; 467 evapi.ref = ev_ref;
460 evapi.unref = ev_unref; 468 evapi.unref = ev_unref;
461 evapi.loop = ev_loop; 469 evapi.run = ev_run;
462 evapi.once = ev_once; 470 evapi.once = ev_once;
463 evapi.io_start = ev_io_start; 471 evapi.io_start = ev_io_start;
464 evapi.io_stop = ev_io_stop; 472 evapi.io_stop = ev_io_stop;
465 evapi.timer_start = ev_timer_start; 473 evapi.timer_start = ev_timer_start;
466 evapi.timer_stop = ev_timer_stop; 474 evapi.timer_stop = ev_timer_stop;
495 evapi.invoke = ev_invoke; 503 evapi.invoke = ev_invoke;
496 504
497 sv_setiv (sv, (IV)&evapi); 505 sv_setiv (sv, (IV)&evapi);
498 SvREADONLY_on (sv); 506 SvREADONLY_on (sv);
499 } 507 }
500#ifndef _WIN32 508#if !defined(_WIN32) && !defined(_MINIX)
501 pthread_atfork (0, 0, ev_default_fork); 509 pthread_atfork (0, 0, ev_default_fork);
502#endif 510#endif
503} 511}
504 512
505SV *ev_default_loop (unsigned int flags = 0) 513SV *ev_default_loop (unsigned int flags = 0)
550 558
551unsigned int ev_backend () 559unsigned int ev_backend ()
552 C_ARGS: evapi.default_loop 560 C_ARGS: evapi.default_loop
553 561
554void ev_verify () 562void ev_verify ()
563 ALIAS:
564 loop_verify = 1
555 C_ARGS: evapi.default_loop 565 C_ARGS: evapi.default_loop
556 566
557unsigned int ev_iteration () 567unsigned int ev_iteration ()
568 ALIAS:
569 loop_count = 1
558 C_ARGS: evapi.default_loop 570 C_ARGS: evapi.default_loop
559 571
560unsigned int ev_depth () 572unsigned int ev_depth ()
573 ALIAS:
574 loop_depth = 1
561 C_ARGS: evapi.default_loop 575 C_ARGS: evapi.default_loop
562 576
563void ev_set_io_collect_interval (NV interval) 577void ev_set_io_collect_interval (NV interval)
564 C_ARGS: evapi.default_loop, interval 578 C_ARGS: evapi.default_loop, interval
565 579
566void ev_set_timeout_collect_interval (NV interval) 580void ev_set_timeout_collect_interval (NV interval)
567 C_ARGS: evapi.default_loop, interval 581 C_ARGS: evapi.default_loop, interval
568 582
569void ev_loop (int flags = 0) 583void ev_run (int flags = 0)
584 ALIAS:
585 loop = 1
570 C_ARGS: evapi.default_loop, flags 586 C_ARGS: evapi.default_loop, flags
571 587
572void ev_unloop (int how = EVUNLOOP_ONE) 588void ev_break (int how = EVBREAK_ONE)
589 ALIAS:
590 unloop = 1
573 C_ARGS: evapi.default_loop, how 591 C_ARGS: evapi.default_loop, how
574 592
575void ev_feed_fd_event (int fd, int revents = EV_NONE) 593void ev_feed_fd_event (int fd, int revents = EV_NONE)
576 C_ARGS: evapi.default_loop, fd, revents 594 C_ARGS: evapi.default_loop, fd, revents
577 595
1285 OUTPUT: 1303 OUTPUT:
1286 RETVAL 1304 RETVAL
1287 1305
1288void DESTROY (struct ev_loop *loop) 1306void DESTROY (struct ev_loop *loop)
1289 CODE: 1307 CODE:
1290 if (loop != evapi.default_loop) /* global destruction sucks */ 1308 /* 1. the default loop shouldn't be freed by destroying it'S pelr loop object */
1309 /* 2. not doing so helps avoid many global destruction bugs in perl, too */
1310 if (loop != evapi.default_loop)
1291 ev_loop_destroy (loop); 1311 ev_loop_destroy (loop);
1292 1312
1293void ev_loop_fork (struct ev_loop *loop) 1313void ev_loop_fork (struct ev_loop *loop)
1294 1314
1315NV ev_now (struct ev_loop *loop)
1316
1317void ev_now_update (struct ev_loop *loop)
1318
1319void ev_suspend (struct ev_loop *loop)
1320
1321void ev_resume (struct ev_loop *loop)
1322
1323void ev_set_io_collect_interval (struct ev_loop *loop, NV interval)
1324
1325void ev_set_timeout_collect_interval (struct ev_loop *loop, NV interval)
1326
1327unsigned int ev_backend (struct ev_loop *loop)
1328
1295void ev_verify (struct ev_loop *loop) 1329void ev_verify (struct ev_loop *loop)
1296 1330 ALIAS:
1297NV ev_now (struct ev_loop *loop) 1331 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 1332
1311unsigned int ev_iteration (struct ev_loop *loop) 1333unsigned int ev_iteration (struct ev_loop *loop)
1334 ALIAS:
1335 loop_count = 1
1312 1336
1313unsigned int ev_depth (struct ev_loop *loop) 1337unsigned int ev_depth (struct ev_loop *loop)
1338 ALIAS:
1339 loop_depth = 1
1314 1340
1315void ev_loop (struct ev_loop *loop, int flags = 0) 1341void ev_run (struct ev_loop *loop, int flags = 0)
1342 ALIAS:
1343 loop = 1
1316 1344
1317void ev_unloop (struct ev_loop *loop, int how = 1) 1345void ev_break (struct ev_loop *loop, int how = 1)
1346 ALIAS:
1347 unloop = 1
1318 1348
1319void ev_feed_fd_event (struct ev_loop *loop, int fd, int revents = EV_NONE) 1349void ev_feed_fd_event (struct ev_loop *loop, int fd, int revents = EV_NONE)
1320 1350
1321unsigned int ev_pending_count (struct ev_loop *loop) 1351unsigned int ev_pending_count (struct ev_loop *loop)
1322 1352

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines