r42950 - in /branches/upstream/libcoro-perl/current: ./ Coro/ EV/ Event/
jawnsy-guest at users.alioth.debian.org
jawnsy-guest at users.alioth.debian.org
Wed Aug 26 20:07:11 UTC 2009
Author: jawnsy-guest
Date: Wed Aug 26 20:07:05 2009
New Revision: 42950
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=42950
Log:
[svn-upgrade] Integrating new upstream version, libcoro-perl (5.170)
Modified:
branches/upstream/libcoro-perl/current/Changes
branches/upstream/libcoro-perl/current/Coro.pm
branches/upstream/libcoro-perl/current/Coro/AIO.pm
branches/upstream/libcoro-perl/current/Coro/AnyEvent.pm
branches/upstream/libcoro-perl/current/Coro/BDB.pm
branches/upstream/libcoro-perl/current/Coro/Channel.pm
branches/upstream/libcoro-perl/current/Coro/Debug.pm
branches/upstream/libcoro-perl/current/Coro/Handle.pm
branches/upstream/libcoro-perl/current/Coro/LWP.pm
branches/upstream/libcoro-perl/current/Coro/MakeMaker.pm
branches/upstream/libcoro-perl/current/Coro/Makefile.PL
branches/upstream/libcoro-perl/current/Coro/RWLock.pm
branches/upstream/libcoro-perl/current/Coro/Select.pm
branches/upstream/libcoro-perl/current/Coro/Semaphore.pm
branches/upstream/libcoro-perl/current/Coro/SemaphoreSet.pm
branches/upstream/libcoro-perl/current/Coro/Signal.pm
branches/upstream/libcoro-perl/current/Coro/Socket.pm
branches/upstream/libcoro-perl/current/Coro/Specific.pm
branches/upstream/libcoro-perl/current/Coro/State.pm
branches/upstream/libcoro-perl/current/Coro/State.xs
branches/upstream/libcoro-perl/current/Coro/Storable.pm
branches/upstream/libcoro-perl/current/Coro/Timer.pm
branches/upstream/libcoro-perl/current/Coro/Util.pm
branches/upstream/libcoro-perl/current/Coro/schmorp.h
branches/upstream/libcoro-perl/current/EV/EV.pm
branches/upstream/libcoro-perl/current/Event/Event.pm
branches/upstream/libcoro-perl/current/META.yml
branches/upstream/libcoro-perl/current/Makefile.PL
Modified: branches/upstream/libcoro-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libcoro-perl/current/Changes?rev=42950&op=diff
==============================================================================
--- branches/upstream/libcoro-perl/current/Changes (original)
+++ branches/upstream/libcoro-perl/current/Changes Wed Aug 26 20:07:05 2009
@@ -7,6 +7,14 @@
TODO: unready_all
TODO: myhttpd header parsing
TODO: channel->maxsize(newsize)?
+
+5.17 Sat Aug 22 23:09:31 CEST 2009
+ - work around a bug in the perl debugger causing crashes
+ when running under the debugger by marking _pool_handler as nodebug.
+ - speed up Coro::async considerably.
+ - try some hacks to get netbsd to work "more often" - their broken
+ setjmp/longjmp, ucontext *and* phtreads are really hard on Coro.
+ - convert Coro to AE 5.0 API.
5.162 Tue Jul 28 04:04:03 CEST 2009
- perl 5.8.2 is now minimum requirement.
Modified: branches/upstream/libcoro-perl/current/Coro.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libcoro-perl/current/Coro.pm?rev=42950&op=diff
==============================================================================
--- branches/upstream/libcoro-perl/current/Coro.pm (original)
+++ branches/upstream/libcoro-perl/current/Coro.pm Wed Aug 26 20:07:05 2009
@@ -82,7 +82,7 @@
our $main; # main coro
our $current; # current coro
-our $VERSION = 5.162;
+our $VERSION = 5.17;
our @EXPORT = qw(async async_pool cede schedule terminate current unblock_sub);
our %EXPORT_TAGS = (
@@ -208,14 +208,6 @@
async {
print "@_\n";
} 1,2,3,4;
-
-=cut
-
-sub async(&@) {
- my $coro = new Coro @_;
- $coro->ready;
- $coro
-}
=item async_pool { ... } [@args...]
Modified: branches/upstream/libcoro-perl/current/Coro/AIO.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libcoro-perl/current/Coro/AIO.pm?rev=42950&op=diff
==============================================================================
--- branches/upstream/libcoro-perl/current/Coro/AIO.pm (original)
+++ branches/upstream/libcoro-perl/current/Coro/AIO.pm Wed Aug 26 20:07:05 2009
@@ -68,7 +68,7 @@
use base Exporter::;
-our $VERSION = 5.162;
+our $VERSION = 5.17;
our @EXPORT = (@IO::AIO::EXPORT, qw(aio_wait));
our @EXPORT_OK = @IO::AIO::EXPORT_OK;
Modified: branches/upstream/libcoro-perl/current/Coro/AnyEvent.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libcoro-perl/current/Coro/AnyEvent.pm?rev=42950&op=diff
==============================================================================
--- branches/upstream/libcoro-perl/current/Coro/AnyEvent.pm (original)
+++ branches/upstream/libcoro-perl/current/Coro/AnyEvent.pm Wed Aug 26 20:07:05 2009
@@ -44,8 +44,7 @@
=head1 FUNCTIONS
-Coro::AnyEvent offers a few functions that might be useful for
-"background" threads:
+Coro::AnyEvent offers a few functions that might be useful.
=over 4
@@ -59,7 +58,7 @@
use Coro;
use AnyEvent ();
-our $VERSION = 5.162;
+our $VERSION = 5.17;
#############################################################################
# idle handler
@@ -72,7 +71,7 @@
our $ACTIVITY;
sub _activity {
- $ACTIVITY ||= AnyEvent->timer (after => 0, cb => \&_schedule);
+ $ACTIVITY ||= AE::timer 0, 0, \&_schedule;
}
Coro::_set_readyhook (\&AnyEvent::detect);
@@ -201,38 +200,38 @@
=cut
sub poll() {
- my $w = AnyEvent->timer (after => 0, cb => Coro::rouse_cb);
+ my $w = AE::timer 0, 0, Coro::rouse_cb;
Coro::rouse_wait;
}
sub sleep($) {
- my $w = AnyEvent->timer (after => $_[0], cb => Coro::rouse_cb);
+ my $w = AE::timer $_[0], 0, Coro::rouse_cb;
Coro::rouse_wait;
}
sub idle() {
- my $w = AnyEvent->idle (cb => Coro::rouse_cb);
+ my $w = AE::idle Coro::rouse_cb;
Coro::rouse_wait;
}
sub idle_upto($) {
my $cb = Coro::rouse_cb;
- my $t = AnyEvent->timer (after => shift, cb => $cb);
- my $w = AnyEvent->idle (cb => $cb);
+ my $t = AE::timer shift, 0, $cb;
+ my $w = AE::idle $cb;
Coro::rouse_wait;
}
sub readable($;$) {
my $cb = Coro::rouse_cb;
- my $w = AnyEvent->io (fh => $_[0], poll => "r", cb => sub { $cb->(1) });
- my $t = defined $_[1] && AnyEvent->timer (after => $_[1], cb => sub { $cb->(0) });
+ my $w = AE::io $_[0], 0, sub { $cb->(1) };
+ my $t = defined $_[1] && AE::timer $_[1], 0, sub { $cb->(0) };
Coro::rouse_wait
}
sub writable($;$) {
my $cb = Coro::rouse_cb;
- my $w = AnyEvent->io (fh => $_[0], poll => "w", cb => sub { $cb->(1) });
- my $t = defined $_[1] && AnyEvent->timer (after => $_[1], cb => sub { $cb->(0) });
+ my $w = AE::io $_[0], 1, sub { $cb->(1) };
+ my $t = defined $_[1] && AE::timer $_[1], 0, sub { $cb->(0) };
Coro::rouse_wait
}
Modified: branches/upstream/libcoro-perl/current/Coro/BDB.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libcoro-perl/current/Coro/BDB.pm?rev=42950&op=diff
==============================================================================
--- branches/upstream/libcoro-perl/current/Coro/BDB.pm (original)
+++ branches/upstream/libcoro-perl/current/Coro/BDB.pm Wed Aug 26 20:07:05 2009
@@ -48,7 +48,7 @@
use base Exporter::;
-our $VERSION = 5.162;
+our $VERSION = 5.17;
our $WATCHER;
BDB::set_sync_prepare {
Modified: branches/upstream/libcoro-perl/current/Coro/Channel.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libcoro-perl/current/Coro/Channel.pm?rev=42950&op=diff
==============================================================================
--- branches/upstream/libcoro-perl/current/Coro/Channel.pm (original)
+++ branches/upstream/libcoro-perl/current/Coro/Channel.pm Wed Aug 26 20:07:05 2009
@@ -33,7 +33,7 @@
use Coro ();
use Coro::Semaphore ();
-our $VERSION = 5.162;
+our $VERSION = 5.17;
sub DATA (){ 0 }
sub SGET (){ 1 }
Modified: branches/upstream/libcoro-perl/current/Coro/Debug.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libcoro-perl/current/Coro/Debug.pm?rev=42950&op=diff
==============================================================================
--- branches/upstream/libcoro-perl/current/Coro/Debug.pm (original)
+++ branches/upstream/libcoro-perl/current/Coro/Debug.pm Wed Aug 26 20:07:05 2009
@@ -122,7 +122,7 @@
use Coro::AnyEvent ();
use Coro::Timer ();
-our $VERSION = 5.162;
+our $VERSION = 5.17;
our %log;
our $SESLOGLEVEL = exists $ENV{PERL_CORO_DEFAULT_LOGLEVEL} ? $ENV{PERL_CORO_DEFAULT_LOGLEVEL} : -1;
Modified: branches/upstream/libcoro-perl/current/Coro/Handle.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libcoro-perl/current/Coro/Handle.pm?rev=42950&op=diff
==============================================================================
--- branches/upstream/libcoro-perl/current/Coro/Handle.pm (original)
+++ branches/upstream/libcoro-perl/current/Coro/Handle.pm Wed Aug 26 20:07:05 2009
@@ -46,7 +46,7 @@
use base 'Exporter';
-our $VERSION = 5.162;
+our $VERSION = 5.17;
our @EXPORT = qw(unblock);
=item $fh = new_from_fh Coro::Handle $fhandle [, arg => value...]
@@ -365,48 +365,20 @@
sub _readable_anyevent {
my $cb = Coro::rouse_cb;
- my $io = 1;
-
- my $w = AnyEvent->io (
- fh => $_[0][0],
- poll => 'r',
- cb => $cb,
- );
-
- my $t = (defined $_[0][2]) && AnyEvent->timer (
- after => $_[0][2],
- cb => sub {
- $io = 0;
- $cb->();
- },
- );
-
- Coro::rouse_wait;
-
- $io
+
+ my $w = AE::io $_[0][0], 0, sub { $cb->(1) };
+ my $t = (defined $_[0][2]) && AE::timer $_[0][2], 0, sub { $cb->(0) };
+
+ Coro::rouse_wait
}
sub _writable_anyevent {
my $cb = Coro::rouse_cb;
- my $io = 1;
-
- my $w = AnyEvent->io (
- fh => $_[0][0],
- poll => 'w',
- cb => $cb,
- );
-
- my $t = (defined $_[0][2]) && AnyEvent->timer (
- after => $_[0][2],
- cb => sub {
- $io = 0;
- $cb->();
- },
- );
-
- Coro::rouse_wait;
-
- $io
+
+ my $w = AE::io $_[0][0], 1, sub { $cb->(1) };
+ my $t = (defined $_[0][2]) && AE::timer $_[0][2], 0, sub { $cb->(0) };
+
+ Coro::rouse_wait
}
sub _readable_coro {
Modified: branches/upstream/libcoro-perl/current/Coro/LWP.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libcoro-perl/current/Coro/LWP.pm?rev=42950&op=diff
==============================================================================
--- branches/upstream/libcoro-perl/current/Coro/LWP.pm (original)
+++ branches/upstream/libcoro-perl/current/Coro/LWP.pm Wed Aug 26 20:07:05 2009
@@ -95,7 +95,7 @@
use Net::FTP ();
use Net::NNTP ();
-our $VERSION = 5.162;
+our $VERSION = 5.17;
*Socket::inet_aton = \&Coro::Util::inet_aton;
Modified: branches/upstream/libcoro-perl/current/Coro/MakeMaker.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libcoro-perl/current/Coro/MakeMaker.pm?rev=42950&op=diff
==============================================================================
--- branches/upstream/libcoro-perl/current/Coro/MakeMaker.pm (original)
+++ branches/upstream/libcoro-perl/current/Coro/MakeMaker.pm Wed Aug 26 20:07:05 2009
@@ -5,7 +5,7 @@
use Config;
use base 'Exporter';
-our $VERSION = 5.162;
+our $VERSION = 5.17;
@EXPORT_OK = qw(&coro_args $installsitearch);
Modified: branches/upstream/libcoro-perl/current/Coro/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libcoro-perl/current/Coro/Makefile.PL?rev=42950&op=diff
==============================================================================
--- branches/upstream/libcoro-perl/current/Coro/Makefile.PL (original)
+++ branches/upstream/libcoro-perl/current/Coro/Makefile.PL Wed Aug 26 20:07:05 2009
@@ -8,6 +8,8 @@
my @LIBS = [];
my $threads = $Config{usethreads};
+
+use Config;
print <<EOF;
@@ -59,10 +61,30 @@
$iface = $iface_asm || "s";
} elsif ($^O =~ /netbsd/) {
- # netbsd is totally broken (pthreads are incomaptible with ucontext or
+ # netbsd is totally broken (pthreads are incompatible with ucontext or
# other stack switching mechanisms) therefore, default to pthread -
- # hey, it might actually work, with some hacks
+ # hey, it might actually work, with some hacks.
$iface = "p";
+
+ if ($Config{libs} =~ "-lpthread") {
+ # uh-oh
+ print <<EOF;
+
+***
+*** WARNING: Your platform is known to have broken pthreads, which are
+*** required for Coro because your platform is known to have broken
+*** ucontext and setjmp/longjmp functions as well, which are broken
+*** because your pthread library is broken. D'oh.
+***
+*** Coro will try to fight this vicious circle of breakage, but YMMV. If
+*** Coro fails, try to recompile your perl with -lpthread, which will work
+*** around some of the pthread bugs. (You do not have to enable ithreads).
+***
+
+EOF
+ # ugh, pthreads need to be linked into the main program :/
+ $iface = $iface_asm || "s";
+ }
} elsif ($^O =~ /(openbsd|mirbsd)/) {
# openbsd:
@@ -163,7 +185,7 @@
retry:
my $r = prompt "Use which implementation,\n" .
- "<s>et/longjump, <u>context, <a>ssembly, <i>rix, <l>inux or <w>indows?",
+ "<s>etjmp, <u>ctx, <a>sm, <i>rix, <l>inux, <w>indows or <p>threads?",
$iface;
$iface = lc $1 if $r =~ /(\S)/;
@@ -186,7 +208,7 @@
print "\nUsing windows-specific implementation\n\n";
} elsif ($iface eq "a") {
$DEFINE .= " -DCORO_ASM";
- print "\nUsing handcoded assembly implementation\n\n";
+ print "\nUsing handcoded assembler implementation\n\n";
} elsif ($iface eq "p") {
$DEFINE .= " -DCORO_PTHREAD";
@LIBS = ["-lpthread"];
Modified: branches/upstream/libcoro-perl/current/Coro/RWLock.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libcoro-perl/current/Coro/RWLock.pm?rev=42950&op=diff
==============================================================================
--- branches/upstream/libcoro-perl/current/Coro/RWLock.pm (original)
+++ branches/upstream/libcoro-perl/current/Coro/RWLock.pm Wed Aug 26 20:07:05 2009
@@ -30,7 +30,7 @@
use Coro ();
-$VERSION = 5.162;
+$VERSION = 5.17;
=item $l = new Coro::RWLock;
Modified: branches/upstream/libcoro-perl/current/Coro/Select.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libcoro-perl/current/Coro/Select.pm?rev=42950&op=diff
==============================================================================
--- branches/upstream/libcoro-perl/current/Coro/Select.pm (original)
+++ branches/upstream/libcoro-perl/current/Coro/Select.pm Wed Aug 26 20:07:05 2009
@@ -67,7 +67,7 @@
use base Exporter::;
-our $VERSION = 5.162;
+our $VERSION = 5.17;
our @EXPORT_OK = "select";
sub import {
@@ -92,7 +92,7 @@
my $wakeup = Coro::rouse_cb;
# AnyEvent does not do 'e', so replace it by 'r'
- for ([0, 'r'], [1, 'w'], [2, 'r']) {
+ for ([0, 0], [1, 1], [2, 0]) {
my ($i, $poll) = @$_;
if (defined $_[$i]) {
my $rvec = \$_[$i];
@@ -105,11 +105,11 @@
my $fd = (pos) - 1;
push @w,
- AnyEvent->io (fh => $fd, poll => $poll, cb => sub {
+ AE::io $fd, $poll, sub {
(vec $$rvec, $fd, 1) = 1;
++$nfound;
$wakeup->();
- });
+ };
}
}
@@ -118,7 +118,7 @@
}
push @w,
- AnyEvent->timer (after => $_[3], cb => $wakeup)
+ AE::timer $_[3], 0, $wakeup
if defined $_[3];
Coro::rouse_wait;
Modified: branches/upstream/libcoro-perl/current/Coro/Semaphore.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libcoro-perl/current/Coro/Semaphore.pm?rev=42950&op=diff
==============================================================================
--- branches/upstream/libcoro-perl/current/Coro/Semaphore.pm (original)
+++ branches/upstream/libcoro-perl/current/Coro/Semaphore.pm Wed Aug 26 20:07:05 2009
@@ -37,7 +37,7 @@
use Coro ();
-$VERSION = 5.162;
+$VERSION = 5.17;
=item new [inital count]
Modified: branches/upstream/libcoro-perl/current/Coro/SemaphoreSet.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libcoro-perl/current/Coro/SemaphoreSet.pm?rev=42950&op=diff
==============================================================================
--- branches/upstream/libcoro-perl/current/Coro/SemaphoreSet.pm (original)
+++ branches/upstream/libcoro-perl/current/Coro/SemaphoreSet.pm Wed Aug 26 20:07:05 2009
@@ -33,7 +33,7 @@
use strict qw(vars subs);
no warnings;
-our $VERSION = 5.162;
+our $VERSION = 5.17;
use Coro::Semaphore ();
Modified: branches/upstream/libcoro-perl/current/Coro/Signal.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libcoro-perl/current/Coro/Signal.pm?rev=42950&op=diff
==============================================================================
--- branches/upstream/libcoro-perl/current/Coro/Signal.pm (original)
+++ branches/upstream/libcoro-perl/current/Coro/Signal.pm Wed Aug 26 20:07:05 2009
@@ -36,7 +36,7 @@
use Coro::Semaphore ();
-our $VERSION = 5.162;
+our $VERSION = 5.17;
=item $sig = new Coro::Signal;
Modified: branches/upstream/libcoro-perl/current/Coro/Socket.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libcoro-perl/current/Coro/Socket.pm?rev=42950&op=diff
==============================================================================
--- branches/upstream/libcoro-perl/current/Coro/Socket.pm (original)
+++ branches/upstream/libcoro-perl/current/Coro/Socket.pm Wed Aug 26 20:07:05 2009
@@ -75,7 +75,7 @@
use base qw(Coro::Handle IO::Socket::INET);
-our $VERSION = 5.162;
+our $VERSION = 5.17;
our (%_proto, %_port);
Modified: branches/upstream/libcoro-perl/current/Coro/Specific.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libcoro-perl/current/Coro/Specific.pm?rev=42950&op=diff
==============================================================================
--- branches/upstream/libcoro-perl/current/Coro/Specific.pm (original)
+++ branches/upstream/libcoro-perl/current/Coro/Specific.pm Wed Aug 26 20:07:05 2009
@@ -26,7 +26,7 @@
BEGIN { eval { require warnings } && warnings->unimport ("uninitialized") }
-$VERSION = 5.162;
+$VERSION = 5.17;
=item new
Modified: branches/upstream/libcoro-perl/current/Coro/State.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libcoro-perl/current/Coro/State.pm?rev=42950&op=diff
==============================================================================
--- branches/upstream/libcoro-perl/current/Coro/State.pm (original)
+++ branches/upstream/libcoro-perl/current/Coro/State.pm Wed Aug 26 20:07:05 2009
@@ -93,7 +93,7 @@
use XSLoader;
BEGIN {
- our $VERSION = 5.162;
+ our $VERSION = 5.17;
# must be done here because the xs part expects it to exist
# it might exist already because Coro::Specific created it.
@@ -132,8 +132,8 @@
The default handlers provided will behave like the built-in ones (as if
they weren't there).
-If you don't want to exit your program on uncaught exceptions, you can
-must not return from your die hook - terminate instead.
+If you don't want to exit your program on uncaught exceptions, you must
+not return from your die hook - call C<Coro::terminate> instead.
Note 1: You I<must> store a valid code reference in these variables,
C<undef> will I<not> do.
@@ -454,7 +454,7 @@
our $main; # main coro
our $current; # current coro
- $main = Coro::State::new Coro::;
+ $main = Coro::new Coro::;
$main->{desc} = "[main::]";
Modified: branches/upstream/libcoro-perl/current/Coro/State.xs
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libcoro-perl/current/Coro/State.xs?rev=42950&op=diff
==============================================================================
--- branches/upstream/libcoro-perl/current/Coro/State.xs (original)
+++ branches/upstream/libcoro-perl/current/Coro/State.xs Wed Aug 26 20:07:05 2009
@@ -144,7 +144,6 @@
static AV *av_async_pool; /* idle pool */
static SV *sv_Coro; /* class string */
static CV *cv_pool_handler;
-static CV *cv_coro_state_new;
/* Coro::AnyEvent */
static SV *sv_activity;
@@ -292,7 +291,7 @@
/* horrible hack, but if it works... */
static OP *
-coro_pp_sselect (aTHX)
+coro_pp_sselect (pTHX)
{
dSP;
PUSHMARK (SP - 4); /* fake argument list */
@@ -1277,7 +1276,8 @@
perl_run (PL_curinterp);
/*
* Unfortunately, there is no way to get at the return values of the
- * coro body here, as perl_run destroys these
+ * coro body here, as perl_run destroys these. Likewise, we cannot catch
+ * runtime errors here, as this is just a random interpreter, not a thread.
*/
/*
@@ -1917,9 +1917,14 @@
HV *hv = (HV *)SvRV (coro_current);
AV *av = newAV ();
- av_extend (av, items - 1);
- for (i = 0; i < items; ++i)
- av_push (av, SvREFCNT_inc_NN (arg [i]));
+ /* items are actually not so common, so optimise for this case */
+ if (items)
+ {
+ av_extend (av, items - 1);
+
+ for (i = 0; i < items; ++i)
+ av_push (av, SvREFCNT_inc_NN (arg [i]));
+ }
hv_store (hv, "_status", sizeof ("_status") - 1, newRV_noinc ((SV *)av), 0);
@@ -2911,6 +2916,64 @@
# include "clone.c"
#endif
+/*****************************************************************************/
+
+static SV *
+coro_new (pTHX_ HV *stash, SV **argv, int argc, int is_coro)
+{
+ SV *coro_sv;
+ struct coro *coro;
+ MAGIC *mg;
+ HV *hv;
+ SV *cb;
+ int i;
+
+ if (argc > 0)
+ {
+ cb = s_get_cv_croak (argv [0]);
+
+ if (!is_coro)
+ {
+ if (CvISXSUB (cb))
+ croak ("Coro::State doesn't support XS functions as coroutine start, caught");
+
+ if (!CvROOT (cb))
+ croak ("Coro::State doesn't support autoloaded or undefined functions as coroutine start, caught");
+ }
+ }
+
+ Newz (0, coro, 1, struct coro);
+ coro->args = newAV ();
+ coro->flags = CF_NEW;
+
+ if (coro_first) coro_first->prev = coro;
+ coro->next = coro_first;
+ coro_first = coro;
+
+ coro->hv = hv = newHV ();
+ mg = sv_magicext ((SV *)hv, 0, CORO_MAGIC_type_state, &coro_state_vtbl, (char *)coro, 0);
+ mg->mg_flags |= MGf_DUP;
+ coro_sv = sv_bless (newRV_noinc ((SV *)hv), stash);
+
+ if (argc > 0)
+ {
+ av_extend (coro->args, argc + is_coro - 1);
+
+ if (is_coro)
+ {
+ av_push (coro->args, SvREFCNT_inc_NN ((SV *)cb));
+ cb = (SV *)cv_coro_run;
+ }
+
+ coro->startcv = (CV *)SvREFCNT_inc_NN ((SV *)cb);
+
+ for (i = 1; i < argc; i++)
+ av_push (coro->args, newSVsv (argv [i]));
+ }
+
+ return coro_sv;
+}
+
MODULE = Coro::State PACKAGE = Coro::State PREFIX = api_
PROTOTYPES: DISABLE
@@ -2988,61 +3051,12 @@
}
SV *
-new (char *klass, ...)
+new (SV *klass, ...)
ALIAS:
Coro::new = 1
CODE:
-{
- struct coro *coro;
- MAGIC *mg;
- HV *hv;
- SV *cb;
- int i;
-
- if (items > 1)
- {
- cb = s_get_cv_croak (ST (1));
-
- if (!ix)
- {
- if (CvISXSUB (cb))
- croak ("Coro::State doesn't support XS functions as coroutine start, caught");
-
- if (!CvROOT (cb))
- croak ("Coro::State doesn't support autoloaded or undefined functions as coroutine start, caught");
- }
- }
-
- Newz (0, coro, 1, struct coro);
- coro->args = newAV ();
- coro->flags = CF_NEW;
-
- if (coro_first) coro_first->prev = coro;
- coro->next = coro_first;
- coro_first = coro;
-
- coro->hv = hv = newHV ();
- mg = sv_magicext ((SV *)hv, 0, CORO_MAGIC_type_state, &coro_state_vtbl, (char *)coro, 0);
- mg->mg_flags |= MGf_DUP;
- RETVAL = sv_bless (newRV_noinc ((SV *)hv), gv_stashpv (klass, 1));
-
- if (items > 1)
- {
- av_extend (coro->args, items - 1 + ix - 1);
-
- if (ix)
- {
- av_push (coro->args, SvREFCNT_inc_NN ((SV *)cb));
- cb = (SV *)cv_coro_run;
- }
-
- coro->startcv = (CV *)SvREFCNT_inc_NN ((SV *)cb);
-
- for (i = 2; i < items; i++)
- av_push (coro->args, newSVsv (ST (i)));
- }
-}
- OUTPUT:
+ RETVAL = coro_new (aTHX_ ix ? coro_stash : coro_state_stash, &ST (1), items - 1, ix);
+ OUTPUT:
RETVAL
void
@@ -3319,8 +3333,8 @@
sv_async_pool_idle = newSVpv ("[async pool idle]", 0); SvREADONLY_on (sv_async_pool_idle);
sv_Coro = newSVpv ("Coro", 0); SvREADONLY_on (sv_Coro);
cv_pool_handler = get_cv ("Coro::pool_handler", GV_ADD); SvREADONLY_on (cv_pool_handler);
- cv_coro_state_new = get_cv ("Coro::State::new", 0); SvREADONLY_on (cv_coro_state_new);
-
+ CvNODEBUG_on (get_cv ("Coro::_pool_handler", 0)); /* work around a debugger bug */
+
coro_stash = gv_stashpv ("Coro", TRUE);
newCONSTSUB (coro_stash, "PRIO_MAX", newSViv (CORO_PRIO_MAX));
@@ -3347,6 +3361,15 @@
SvREADONLY_on (sv);
}
}
+
+SV *
+async (...)
+ PROTOTYPE: &@
+ CODE:
+ RETVAL = coro_new (aTHX_ coro_stash, &ST (0), items, 1);
+ api_ready (aTHX_ RETVAL);
+ OUTPUT:
+ RETVAL
void
terminate (...)
@@ -3474,15 +3497,9 @@
if ((SV *)hv == &PL_sv_undef)
{
- PUSHMARK (SP);
- EXTEND (SP, 2);
- PUSHs (sv_Coro);
- PUSHs ((SV *)cv_pool_handler);
- PUTBACK;
- call_sv ((SV *)cv_coro_state_new, G_SCALAR);
- SPAGAIN;
-
- hv = (HV *)SvREFCNT_inc_NN (SvRV (POPs));
+ SV *sv = coro_new (aTHX_ coro_stash, (SV **)&cv_pool_handler, 1, 1);
+ hv = (HV *)SvREFCNT_inc_NN (SvRV (sv));
+ SvREFCNT_dec (sv);
}
{
Modified: branches/upstream/libcoro-perl/current/Coro/Storable.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libcoro-perl/current/Coro/Storable.pm?rev=42950&op=diff
==============================================================================
--- branches/upstream/libcoro-perl/current/Coro/Storable.pm (original)
+++ branches/upstream/libcoro-perl/current/Coro/Storable.pm Wed Aug 26 20:07:05 2009
@@ -85,7 +85,7 @@
use Storable;
use base "Exporter";
-our $VERSION = 5.162;
+our $VERSION = 5.17;
our @EXPORT = qw(thaw freeze nfreeze blocking_thaw blocking_freeze blocking_nfreeze);
our $GRANULARITY = 0.01;
Modified: branches/upstream/libcoro-perl/current/Coro/Timer.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libcoro-perl/current/Coro/Timer.pm?rev=42950&op=diff
==============================================================================
--- branches/upstream/libcoro-perl/current/Coro/Timer.pm (original)
+++ branches/upstream/libcoro-perl/current/Coro/Timer.pm Wed Aug 26 20:07:05 2009
@@ -30,7 +30,7 @@
use Coro ();
use Coro::AnyEvent ();
-$VERSION = 5.162;
+$VERSION = 5.17;
@EXPORT_OK = qw(timeout sleep);
=item $flag = timeout $seconds;
@@ -53,12 +53,11 @@
=cut
-# deep magic, expecially the double indirection :(:(
sub timeout($) {
my $current = $Coro::current;
my $timeout;
bless {
- timer => AnyEvent->timer (after => $_[0], cb => sub {
+ timer => (AE::timer $_[0], 0, sub {
$timeout = 1;
$current->ready;
}),
@@ -82,7 +81,7 @@
=cut
sub sleep {
- my $timer = AnyEvent->timer (after => $_[0], cb => Coro::rouse_cb);
+ my $timer = AE::timer $_[0], 0, Coro::rouse_cb;
Coro::rouse_wait;
}
Modified: branches/upstream/libcoro-perl/current/Coro/Util.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libcoro-perl/current/Coro/Util.pm?rev=42950&op=diff
==============================================================================
--- branches/upstream/libcoro-perl/current/Coro/Util.pm (original)
+++ branches/upstream/libcoro-perl/current/Coro/Util.pm Wed Aug 26 20:07:05 2009
@@ -39,7 +39,7 @@
our @EXPORT = qw(gethostbyname gethostbyaddr);
our @EXPORT_OK = qw(inet_aton fork_eval);
-our $VERSION = 5.162;
+our $VERSION = 5.17;
our $MAXPARALLEL = 16; # max. number of parallel jobs
@@ -61,13 +61,13 @@
my $buf;
my $wakeup = Coro::rouse_cb;
- my $w; $w = AnyEvent->io (fh => $fh, poll => 'r', cb => sub {
+ my $w; $w = AE::io $fh, 0, sub {
sysread $fh, $buf, 16384, length $buf
and return;
undef $w;
$wakeup->();
- });
+ };
Coro::rouse_wait;
Modified: branches/upstream/libcoro-perl/current/Coro/schmorp.h
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libcoro-perl/current/Coro/schmorp.h?rev=42950&op=diff
==============================================================================
--- branches/upstream/libcoro-perl/current/Coro/schmorp.h (original)
+++ branches/upstream/libcoro-perl/current/Coro/schmorp.h Wed Aug 26 20:07:05 2009
@@ -478,9 +478,9 @@
pfd.fd = s_epipe_fd (epp);
pfd.events = POLLIN;
- return poll (&pfd, 1, 0);
-#endif
-}
-
-#endif
-
+ return poll (&pfd, 1, -1);
+#endif
+}
+
+#endif
+
Modified: branches/upstream/libcoro-perl/current/EV/EV.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libcoro-perl/current/EV/EV.pm?rev=42950&op=diff
==============================================================================
--- branches/upstream/libcoro-perl/current/EV/EV.pm (original)
+++ branches/upstream/libcoro-perl/current/EV/EV.pm Wed Aug 26 20:07:05 2009
@@ -58,7 +58,7 @@
use XSLoader;
BEGIN {
- our $VERSION = 5.162;
+ our $VERSION = 5.17;
local $^W = 0; # avoid redefine warning for Coro::ready;
XSLoader::load __PACKAGE__, $VERSION;
@@ -70,7 +70,7 @@
&Coro::schedule;
}
};
-$IDLE->{desc} = "[EV idle process]";
+$IDLE->{desc} = "[EV idle thread]";
$Coro::idle = $IDLE;
Modified: branches/upstream/libcoro-perl/current/Event/Event.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libcoro-perl/current/Event/Event.pm?rev=42950&op=diff
==============================================================================
--- branches/upstream/libcoro-perl/current/Event/Event.pm (original)
+++ branches/upstream/libcoro-perl/current/Event/Event.pm Wed Aug 26 20:07:05 2009
@@ -93,7 +93,7 @@
our @EXPORT = qw(loop unloop sweep);
BEGIN {
- our $VERSION = 5.162;
+ our $VERSION = 5.17;
local $^W = 0; # avoid redefine warning for Coro::ready;
XSLoader::load __PACKAGE__, $VERSION;
@@ -197,7 +197,7 @@
&Coro::schedule;
}
};
-$IDLE->{desc} = "[Event idle process]";
+$IDLE->{desc} = "[Event idle thread]";
$Coro::idle = $IDLE;
Modified: branches/upstream/libcoro-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libcoro-perl/current/META.yml?rev=42950&op=diff
==============================================================================
--- branches/upstream/libcoro-perl/current/META.yml (original)
+++ branches/upstream/libcoro-perl/current/META.yml Wed Aug 26 20:07:05 2009
@@ -11,7 +11,7 @@
},
"generated_by" : "ExtUtils::MakeMaker version 6.50",
"distribution_type" : "module",
- "version" : "5.162",
+ "version" : "5.17",
"name" : "Coro",
"author" : [],
"license" : "unknown",
@@ -20,7 +20,7 @@
},
"requires" : {
"Scalar::Util" : 0,
- "AnyEvent" : 4.81,
+ "AnyEvent" : 5,
"Guard" : 0.5,
"Storable" : 2.15,
"Time::HiRes" : 0,
Modified: branches/upstream/libcoro-perl/current/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libcoro-perl/current/Makefile.PL?rev=42950&op=diff
==============================================================================
--- branches/upstream/libcoro-perl/current/Makefile.PL (original)
+++ branches/upstream/libcoro-perl/current/Makefile.PL Wed Aug 26 20:07:05 2009
@@ -16,21 +16,6 @@
}
print "*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***\n\n";
-
-if ($] < 5.006) {
- print <<EOF;
-
-***
-*** WARNING: This module is quite low-level and uses undocumented perl
-*** internals to do it's job. While it seems to work fine with perl-5.[6-10]
-*** it has not been tested with older versions. If it compiles and passes the
-*** testsuite, it should work. Otherwise you should either upgrade or fix it ;)
-***
-*** Marc Lehmann <schmorp\@schmorp.de>
-***
-
-EOF
-}
if (eval { require Event }) {
if ($Event::VERSION < 0.86 or $Event::VERSION == 0.88) {
@@ -86,7 +71,7 @@
PREREQ_PM => {
common::sense => 0,
Scalar::Util => 0.00,
- AnyEvent => 4.81,
+ AnyEvent => 5.0,
Storable => 2.15,
Time::HiRes => 0,
Guard => 0.5,
@@ -99,7 +84,7 @@
# for Coro::AIO
#IO::AIO => 2.3,
- #AnyEvent::AIO => 1.0,
+ #AnyEvent::AIO => 1.1,
# for Coro::BDB
#BDB => 1.5,
More information about the Pkg-perl-cvs-commits
mailing list