r48879 - in /branches/upstream/libcoro-perl/current: ./ Coro/ EV/ Event/

jawnsy-guest at users.alioth.debian.org jawnsy-guest at users.alioth.debian.org
Wed Dec 16 16:54:04 UTC 2009


Author: jawnsy-guest
Date: Wed Dec 16 16:53:57 2009
New Revision: 48879

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=48879
Log:
[svn-upgrade] Integrating new upstream version, libcoro-perl (5.210)

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/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/EV/EV.pm
    branches/upstream/libcoro-perl/current/Event/Event.pm
    branches/upstream/libcoro-perl/current/META.json
    branches/upstream/libcoro-perl/current/META.yml
    branches/upstream/libcoro-perl/current/README

Modified: branches/upstream/libcoro-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libcoro-perl/current/Changes?rev=48879&op=diff
==============================================================================
--- branches/upstream/libcoro-perl/current/Changes (original)
+++ branches/upstream/libcoro-perl/current/Changes Wed Dec 16 16:53:57 2009
@@ -7,6 +7,17 @@
 TODO: unready_all
 TODO: myhttpd header parsing
 TODO: channel->maxsize(newsize)?
+
+5.21  Wed Dec 16 07:19:51 CET 2009
+        - automatically load Coro::AnyEvent when AnyEvent and Coro are used
+          together.
+        - add some examples on how to combine other event loops with Coro in
+          Coro::AnyEvent, and how to run it (and not to block). Seems to be
+          the most common source of confusion.
+        - try to catch people naively blocking in an event callback.
+        - work around the perl filehandle bug issue in conjunction with
+          older common::sense (as indirectly pointed out by ZSystem).
+	- clarify the "not from signal handlers" section.
 
 5.2   Sun Oct  4 14:54:24 CEST 2009
         - Coro::Storable destroyed the prototypes of the functions it wrapped.

Modified: branches/upstream/libcoro-perl/current/Coro.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libcoro-perl/current/Coro.pm?rev=48879&op=diff
==============================================================================
--- branches/upstream/libcoro-perl/current/Coro.pm (original)
+++ branches/upstream/libcoro-perl/current/Coro.pm Wed Dec 16 16:53:57 2009
@@ -83,7 +83,7 @@
 our $main;    # main coro
 our $current; # current coro
 
-our $VERSION = 5.2;
+our $VERSION = 5.21;
 
 our @EXPORT = qw(async async_pool cede schedule terminate current unblock_sub rouse_cb rouse_wait);
 our %EXPORT_TAGS = (
@@ -667,6 +667,10 @@
 otherwise you might suffer from crashes or worse. The only event library
 currently known that is safe to use without C<unblock_sub> is L<EV>.
 
+Coro will try to catch you when you block in the event loop
+("FATAL:$Coro::IDLE blocked itself"), but this is just best effort and
+only works when you do not run your own event loop.
+
 This function allows your callbacks to block by executing them in another
 coro where it is safe to block. One example where blocking is handy
 is when you use the L<Coro::AIO|Coro::AIO> functions to save results to
@@ -832,8 +836,9 @@
 
 =item coro switching is not signal safe
 
-You must not switch to another coro from within a signal handler
-(only relevant with %SIG - most event libraries provide safe signals).
+You must not switch to another coro from within a signal handler (only
+relevant with %SIG - most event libraries provide safe signals), I<unless>
+you are sure you are not interrupting a Coro function.
 
 That means you I<MUST NOT> call any function that might "block" the
 current coro - C<cede>, C<schedule> C<< Coro::Semaphore->down >> or

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=48879&op=diff
==============================================================================
--- branches/upstream/libcoro-perl/current/Coro/AIO.pm (original)
+++ branches/upstream/libcoro-perl/current/Coro/AIO.pm Wed Dec 16 16:53:57 2009
@@ -68,7 +68,7 @@
 
 use base Exporter::;
 
-our $VERSION = 5.2;
+our $VERSION = 5.21;
 
 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=48879&op=diff
==============================================================================
--- branches/upstream/libcoro-perl/current/Coro/AnyEvent.pm (original)
+++ branches/upstream/libcoro-perl/current/Coro/AnyEvent.pm Wed Dec 16 16:53:57 2009
@@ -5,9 +5,10 @@
 =head1 SYNOPSIS
 
  use Coro;
- use Coro::AnyEvent;
-
- # use coro within an AnyEvent environment
+ use AnyEvent;
+ # using both Coro and AnyEvent will automatically load Coro::AnyEvent
+
+ # use Coro within an AnyEvent environment
 
 =head1 DESCRIPTION
 
@@ -23,18 +24,71 @@
 AnyEvent, combining event-based programming with coroutine-based
 programming in a natural way.
 
-All you have to do is C<use Coro::AnyEvent>, run the event loop of your
-choice in some thread and then you can run threads freely.
+As of Coro 5.21 and newer, this module gets loaded automatically when
+AnyEvent initialises itself and Coro is used in the same process, thus
+there is no need to load it manually if you just want your threads to
+coexist with AnyEvent.
+
+If you want to use any functions from this module, you of course still
+need to C<use Coro::AnyEvent>, just as with other perl modules.
+
+Also, this module autodetects the event loop used (by relying on
+L<AnyEvent>) and will either automatically defer to the high-performance
+L<Coro::EV> or L<Coro::Event> modules, or will use a generic integration
+method that should work with any event loop supported by L<AnyEvent>.
 
 =head1 USAGE
 
-This module autodetects the event loop used (by relying on L<AnyEvent>)
-and will either automatically defer to the high-performance L<Coro::EV> or
-L<Coro::Event> modules, or will use a generic integration into any event
-loop supported by L<AnyEvent>.
-
-Note that if you need to wait for a single event, the rouse functions will
-come in handy (see the Coro manpage for details):
+=head2 RUN AN EVENT LOOP - OR NOT?
+
+For performance reasons, it is recommended that the main program or
+something else runs the event loop of the event model you use, i.e.
+
+   use Gtk2; # <- the event model
+   use AnyEvent;
+   use Coro:
+
+   # initialise stuff
+   async { ... };
+
+   # now run mainloop of Gtk2
+   main Gtk2;
+
+You can move the event loop into a thread as well, although this tends to
+get confusing:
+
+   use Gtk2;
+   use AnyEvent;
+   use Coro:
+
+   async { main Gtk2 };
+
+   # do other things...
+   while () {
+      use Coro::AnyEvent;
+      Coro::AnyEvent::sleep 1;
+      print "ping...\n";
+   }
+
+You can also do nothing, in which case Coro:AnyEvent will invoke the event
+loop as needed, which is less efficient, but sometimes very convenient.
+
+What you I<MUST NOT DO EVER> is to block inside an event loop
+callback. The reason is that most event loops are not reentrant and this
+can cause a deadlock at best and corrupt memory at worst.
+
+Coro will try to catch you when you block in the event loop
+("FATAL:$Coro::IDLE blocked itself"), but this is just best effort and
+only works when you do not run your own event loop.
+
+To avoid this problem, simply do not block inside an event callback
+- start a new thread (e.g. with C<Coro:async_pool>) or use
+C<Coro::unblock_sub>.
+
+=head2 INVERSION OF CONTROL
+
+If you need to wait for a single event, the rouse functions will come in
+handy (see the Coro manpage for details):
 
    # wait for single SIGINT
    {
@@ -42,9 +96,53 @@
       Coro::rouse_wait;
    }
 
+=head2 EVENT MODULES OTHER THEN ANYEVENT
+
+Keep in mind that, as shipped, Coro and Coro::AnyEvent only work with
+AnyEvent, and only when AnyEvent is actually used (i.e. initialised), so
+this will not work:
+
+   # does not work: EV without AnyEvent is not recognised
+   use EV;
+   use Coro;
+
+   EV::loop;
+
+And neither does this, unless you actually I<use> AnyEvent for something:
+
+   # does not work: AnyEvent must be initialised (e.g. by creating watchers)
+   use EV;
+   use AnyEvent;
+   use Coro;
+
+   EV::loop;
+
+This does work, however, because you create a watcher (condvars work,
+too), thus forcing AnyEvent to initialise itself:
+
+   # does work: AnyEvent is actually used
+   use EV;
+   use AnyEvent;
+   use Coro;
+
+   my $timer = AE::timer 1, 1, sub { };
+
+   EV::loop;
+
+And if you want to use AnyEvent just to bridge between Coro and your event
+model of choice, you can simply force it to initialise itself, like this:
+
+   # does work: AnyEvent is initialised manually
+   use POE;
+   use AnyEvent;
+   use Coro;
+
+   AnyEvent::detect; # force AnyEvent to integrate Coro into POE
+   POE::Kernel->run;
+
 =head1 FUNCTIONS
 
-Coro::AnyEvent offers a few functions that might be useful.
+Coro::AnyEvent also offers a few functions that might be useful.
 
 =over 4
 
@@ -57,7 +155,7 @@
 use Coro;
 use AnyEvent ();
 
-our $VERSION = 5.2;
+our $VERSION = 5.21;
 
 #############################################################################
 # idle handler
@@ -118,7 +216,7 @@
 
          while () {
             $one_event->();
-            Coro::schedule;
+            Coro::schedule if Coro::nready;
          }
       };
       $IDLE->{desc} = "[AnyEvent idle process]";

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=48879&op=diff
==============================================================================
--- branches/upstream/libcoro-perl/current/Coro/BDB.pm (original)
+++ branches/upstream/libcoro-perl/current/Coro/BDB.pm Wed Dec 16 16:53:57 2009
@@ -47,7 +47,7 @@
 
 use base Exporter::;
 
-our $VERSION = 5.2;
+our $VERSION = 5.21;
 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=48879&op=diff
==============================================================================
--- branches/upstream/libcoro-perl/current/Coro/Channel.pm (original)
+++ branches/upstream/libcoro-perl/current/Coro/Channel.pm Wed Dec 16 16:53:57 2009
@@ -32,12 +32,11 @@
 use Coro ();
 use Coro::Semaphore ();
 
-our $VERSION = 5.2;
+our $VERSION = 5.21;
 
 sub DATA (){ 0 }
 sub SGET (){ 1 }
 sub SPUT (){ 2 }
-sub CEOS (){ 3 }
 
 =item $q = new Coro:Channel $maxsize
 
@@ -53,9 +52,9 @@
 sub new {
    # we cheat and set infinity == 2*10**9
    bless [
-      [],
-      (Coro::Semaphore::_alloc 0),
-      (Coro::Semaphore::_alloc +($_[1] || 2_000_000_000) - 1),
+      [], # initially empty
+      (Coro::Semaphore::_alloc 0), # counts data
+      (Coro::Semaphore::_alloc +($_[1] || 2_000_000_000) - 1), # counts remaining space
    ]
 }
 
@@ -125,13 +124,20 @@
 includes any coroutines waiting to put data into the channel (but not any
 shutdown condition).
 
-This means that the number returned is I<precisely> the number of calls to
-C<get> that will succeed instantly and returning some data.
+This means that the number returned is I<precisely> the number of calls
+to C<get> that will succeed instantly and return some data. Calling
+C<shutdown> has no effect on this number.
 
 =cut
 
 sub size {
    scalar @{$_[0][DATA]}
+}
+
+# this is not undocumented by accident - if it breaks, you
+# get to keep the pieces
+sub adjust {
+   Coro::Semaphore::adjust $_[0][SPUT], $_[1];
 }
 
 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=48879&op=diff
==============================================================================
--- branches/upstream/libcoro-perl/current/Coro/Debug.pm (original)
+++ branches/upstream/libcoro-perl/current/Coro/Debug.pm Wed Dec 16 16:53:57 2009
@@ -121,7 +121,7 @@
 use Coro::AnyEvent ();
 use Coro::Timer ();
 
-our $VERSION = 5.2;
+our $VERSION = 5.21;
 
 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=48879&op=diff
==============================================================================
--- branches/upstream/libcoro-perl/current/Coro/Handle.pm (original)
+++ branches/upstream/libcoro-perl/current/Coro/Handle.pm Wed Dec 16 16:53:57 2009
@@ -45,7 +45,7 @@
 
 use base 'Exporter';
 
-our $VERSION = 5.2;
+our $VERSION = 5.21;
 our @EXPORT = qw(unblock);
 
 =item $fh = new_from_fh Coro::Handle $fhandle [, arg => value...]
@@ -343,8 +343,9 @@
 }
 
 sub CLOSE {
+   my $fh = $_[0][0];
    &cleanup;
-   close $_[0][0]
+   close $fh
 }
 
 sub DESTROY {

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=48879&op=diff
==============================================================================
--- branches/upstream/libcoro-perl/current/Coro/LWP.pm (original)
+++ branches/upstream/libcoro-perl/current/Coro/LWP.pm Wed Dec 16 16:53:57 2009
@@ -94,7 +94,7 @@
 use Net::FTP ();
 use Net::NNTP ();
 
-our $VERSION = 5.2;
+our $VERSION = 5.21;
 
 *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=48879&op=diff
==============================================================================
--- branches/upstream/libcoro-perl/current/Coro/MakeMaker.pm (original)
+++ branches/upstream/libcoro-perl/current/Coro/MakeMaker.pm Wed Dec 16 16:53:57 2009
@@ -7,7 +7,7 @@
 
 our $installsitearch;
 
-our $VERSION = 5.2;
+our $VERSION = 5.21;
 our @EXPORT_OK = qw(&coro_args $installsitearch);
 
 my %opt;

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=48879&op=diff
==============================================================================
--- branches/upstream/libcoro-perl/current/Coro/RWLock.pm (original)
+++ branches/upstream/libcoro-perl/current/Coro/RWLock.pm Wed Dec 16 16:53:57 2009
@@ -30,7 +30,7 @@
 
 use Coro ();
 
-our $VERSION = 5.2;
+our $VERSION = 5.21;
 
 =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=48879&op=diff
==============================================================================
--- branches/upstream/libcoro-perl/current/Coro/Select.pm (original)
+++ branches/upstream/libcoro-perl/current/Coro/Select.pm Wed Dec 16 16:53:57 2009
@@ -67,7 +67,7 @@
 
 use base Exporter::;
 
-our $VERSION = 5.2;
+our $VERSION = 5.21;
 our @EXPORT_OK = "select";
 
 sub import {

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=48879&op=diff
==============================================================================
--- branches/upstream/libcoro-perl/current/Coro/Semaphore.pm (original)
+++ branches/upstream/libcoro-perl/current/Coro/Semaphore.pm Wed Dec 16 16:53:57 2009
@@ -37,7 +37,7 @@
 
 use Coro ();
 
-our $VERSION = 5.2;
+our $VERSION = 5.21;
 
 =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=48879&op=diff
==============================================================================
--- branches/upstream/libcoro-perl/current/Coro/SemaphoreSet.pm (original)
+++ branches/upstream/libcoro-perl/current/Coro/SemaphoreSet.pm Wed Dec 16 16:53:57 2009
@@ -32,7 +32,7 @@
 
 use common::sense;
 
-our $VERSION = 5.2;
+our $VERSION = 5.21;
 
 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=48879&op=diff
==============================================================================
--- branches/upstream/libcoro-perl/current/Coro/Signal.pm (original)
+++ branches/upstream/libcoro-perl/current/Coro/Signal.pm Wed Dec 16 16:53:57 2009
@@ -35,7 +35,7 @@
 
 use Coro::Semaphore ();
 
-our $VERSION = 5.2;
+our $VERSION = 5.21;
 
 =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=48879&op=diff
==============================================================================
--- branches/upstream/libcoro-perl/current/Coro/Socket.pm (original)
+++ branches/upstream/libcoro-perl/current/Coro/Socket.pm Wed Dec 16 16:53:57 2009
@@ -73,7 +73,7 @@
 
 use base qw(Coro::Handle IO::Socket::INET);
 
-our $VERSION = 5.2;
+our $VERSION = 5.21;
 
 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=48879&op=diff
==============================================================================
--- branches/upstream/libcoro-perl/current/Coro/Specific.pm (original)
+++ branches/upstream/libcoro-perl/current/Coro/Specific.pm Wed Dec 16 16:53:57 2009
@@ -26,7 +26,7 @@
 
 use common::sense;
 
-our $VERSION = 5.2;
+our $VERSION = 5.21;
 
 =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=48879&op=diff
==============================================================================
--- branches/upstream/libcoro-perl/current/Coro/State.pm (original)
+++ branches/upstream/libcoro-perl/current/Coro/State.pm Wed Dec 16 16:53:57 2009
@@ -92,7 +92,7 @@
 use XSLoader;
 
 BEGIN {
-   our $VERSION = 5.2;
+   our $VERSION = 5.21;
 
    # must be done here because the xs part expects it to exist
    # it might exist already because Coro::Specific created it.
@@ -504,6 +504,14 @@
    _set_current $main;
 }
 
+# we also make sure we have Coro::AnyEvent when AnyEvent is used,
+# without loading or initialising AnyEvent
+if (defined $AnyEvent::MODEL) {
+   require Coro::AnyEvent;
+} else {
+   push @AnyEvent::post_detect, sub { require Coro::AnyEvent };
+}
+
 1;
 
 =back

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=48879&op=diff
==============================================================================
--- branches/upstream/libcoro-perl/current/Coro/State.xs (original)
+++ branches/upstream/libcoro-perl/current/Coro/State.xs Wed Dec 16 16:53:57 2009
@@ -1826,6 +1826,9 @@
           if (SvROK (sv_idle)
               && SvOBJECT (SvRV (sv_idle)))
             {
+              if (SvRV (sv_idle) == SvRV (coro_current))
+                croak ("FATAL: $Coro::IDLE blocked itself - did you try to block inside an event loop callback? Caught");
+
               ++coro_nready; /* hack so that api_ready doesn't invoke ready hook */
               api_ready (aTHX_ SvRV (sv_idle));
               --coro_nready;

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=48879&op=diff
==============================================================================
--- branches/upstream/libcoro-perl/current/Coro/Storable.pm (original)
+++ branches/upstream/libcoro-perl/current/Coro/Storable.pm Wed Dec 16 16:53:57 2009
@@ -84,7 +84,7 @@
 use Storable;
 use base "Exporter";
 
-our $VERSION = 5.2;
+our $VERSION = 5.21;
 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=48879&op=diff
==============================================================================
--- branches/upstream/libcoro-perl/current/Coro/Timer.pm (original)
+++ branches/upstream/libcoro-perl/current/Coro/Timer.pm Wed Dec 16 16:53:57 2009
@@ -30,7 +30,7 @@
 use Coro ();
 use Coro::AnyEvent ();
 
-our $VERSION = 5.2;
+our $VERSION = 5.21;
 our @EXPORT_OK = qw(timeout sleep);
 
 =item $flag = timeout $seconds;

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=48879&op=diff
==============================================================================
--- branches/upstream/libcoro-perl/current/Coro/Util.pm (original)
+++ branches/upstream/libcoro-perl/current/Coro/Util.pm Wed Dec 16 16:53:57 2009
@@ -38,7 +38,7 @@
 our @EXPORT = qw(gethostbyname gethostbyaddr);
 our @EXPORT_OK = qw(inet_aton fork_eval);
 
-our $VERSION = 5.2;
+our $VERSION = 5.21;
 
 our $MAXPARALLEL = 16; # max. number of parallel jobs
 

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=48879&op=diff
==============================================================================
--- branches/upstream/libcoro-perl/current/EV/EV.pm (original)
+++ branches/upstream/libcoro-perl/current/EV/EV.pm Wed Dec 16 16:53:57 2009
@@ -56,7 +56,7 @@
 use XSLoader;
 
 BEGIN {
-   our $VERSION = 5.2;
+   our $VERSION = 5.21;
 
    local $^W = 0; # avoid redefine warning for Coro::ready;
    XSLoader::load __PACKAGE__, $VERSION;
@@ -65,7 +65,7 @@
 our $IDLE = new Coro sub {
    while () {
       &_loop_oneshot;
-      &Coro::schedule;
+      Coro::schedule if Coro::nready;
    }
 };
 $IDLE->{desc} = "[EV idle thread]";

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=48879&op=diff
==============================================================================
--- branches/upstream/libcoro-perl/current/Event/Event.pm (original)
+++ branches/upstream/libcoro-perl/current/Event/Event.pm Wed Dec 16 16:53:57 2009
@@ -92,7 +92,7 @@
 our @EXPORT = qw(loop unloop sweep);
 
 BEGIN {
-   our $VERSION = 5.2;
+   our $VERSION = 5.21;
 
    local $^W = 0; # avoid redefine warning for Coro::ready;
    XSLoader::load __PACKAGE__, $VERSION;
@@ -192,8 +192,8 @@
 # very inefficient
 our $IDLE = new Coro sub {
    while () {
-      &Event::one_event;
-      &Coro::schedule;
+      Event::one_event;
+      Coro::schedule if Coro::nready;
    }
 };
 $IDLE->{desc} = "[Event idle thread]";

Modified: branches/upstream/libcoro-perl/current/META.json
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libcoro-perl/current/META.json?rev=48879&op=diff
==============================================================================
--- branches/upstream/libcoro-perl/current/META.json (original)
+++ branches/upstream/libcoro-perl/current/META.json Wed Dec 16 16:53:57 2009
@@ -1,1 +1,1 @@
-{"no_index":{"directory":["t","inc"]},"meta-spec":{"version":1.4,"url":"http://module-build.sourceforge.net/META-spec-v1.4.html"},"generated_by":"ExtUtils::MakeMaker version 6.54","distribution_type":"module","version":"5.2","name":"Coro","author":[],"license":"unknown","build_requires":{"ExtUtils::MakeMaker":0},"requires":{"Scalar::Util":0,"AnyEvent":5,"Guard":0.5,"Storable":2.15,"Time::HiRes":0,"common::sense":0},"recommends":{"BDB":0,"AnyEvent::AIO":1,"Event":1.08,"EV":3,"IO::AIO":3.1,"AnyEvent::BDB":1},"abstract":null,"configure_requires":{"ExtUtils::MakeMaker":0}}
+{"no_index":{"directory":["t","inc"]},"meta-spec":{"version":1.4,"url":"http://module-build.sourceforge.net/META-spec-v1.4.html"},"generated_by":"ExtUtils::MakeMaker version 6.54","distribution_type":"module","version":"5.21","name":"Coro","author":[],"license":"unknown","build_requires":{"ExtUtils::MakeMaker":0},"requires":{"Scalar::Util":0,"AnyEvent":5,"Guard":0.5,"Storable":2.15,"Time::HiRes":0,"common::sense":0},"recommends":{"BDB":0,"AnyEvent::AIO":1,"Event":1.08,"EV":3,"IO::AIO":3.1,"AnyEvent::BDB":1},"abstract":null,"configure_requires":{"ExtUtils::MakeMaker":0}}

Modified: branches/upstream/libcoro-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libcoro-perl/current/META.yml?rev=48879&op=diff
==============================================================================
--- branches/upstream/libcoro-perl/current/META.yml (original)
+++ branches/upstream/libcoro-perl/current/META.yml Wed Dec 16 16:53:57 2009
@@ -11,7 +11,7 @@
    },
    "generated_by" : "ExtUtils::MakeMaker version 6.54",
    "distribution_type" : "module",
-   "version" : "5.2",
+   "version" : "5.21",
    "name" : "Coro",
    "author" : [],
    "license" : "unknown",

Modified: branches/upstream/libcoro-perl/current/README
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libcoro-perl/current/README?rev=48879&op=diff
==============================================================================
--- branches/upstream/libcoro-perl/current/README (original)
+++ branches/upstream/libcoro-perl/current/README Wed Dec 16 16:53:57 2009
@@ -476,6 +476,10 @@
         library currently known that is safe to use without "unblock_sub" is
         EV.
 
+        Coro will try to catch you when you block in the event loop
+        ("FATAL:$Coro::IDLE blocked itself"), but this is just best effort
+        and only works when you do not run your own event loop.
+
         This function allows your callbacks to block by executing them in
         another coro where it is safe to block. One example where blocking
         is handy is when you use the Coro::AIO functions to save results to
@@ -597,7 +601,8 @@
     coro switching is not signal safe
         You must not switch to another coro from within a signal handler
         (only relevant with %SIG - most event libraries provide safe
-        signals).
+        signals), *unless* you are sure you are not interrupting a Coro
+        function.
 
         That means you *MUST NOT* call any function that might "block" the
         current coro - "cede", "schedule" "Coro::Semaphore->down" or




More information about the Pkg-perl-cvs-commits mailing list