The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.
Changes 314
Coro/AIO.pm 11
Coro/AnyEvent.pm 11
Coro/BDB.pm 11
Coro/Channel.pm 11
Coro/Debug.pm 11
Coro/Handle.pm 13
Coro/LWP.pm 11
Coro/MakeMaker.pm 11
Coro/RWLock.pm 11
Coro/Select.pm 11
Coro/Semaphore.pm 11
Coro/SemaphoreSet.pm 11
Coro/Signal.pm 11
Coro/Socket.pm 11
Coro/Specific.pm 11
Coro/State.pm 11
Coro/State.xs 05
Coro/Storable.pm 11
Coro/Timer.pm 11
Coro/Util.pm 11
Coro/ecb.h 317
Coro/state.h 33
Coro.pm 1116
EV/EV.pm 11
Event/Event.pm 11
META.json 22
META.yml 1717
README 1620
29 files changed (This is a version diff) 76117
@@ -5,9 +5,20 @@ TODO: channel->maxsize(newsize)?
 TODO: __GCC_HAVE_DWARF2_CFI_ASM
 TODO: swap_sv, maybe add scope_swap_sv, andallow to unswap by repeat?
 TODO: swap_sv not undone in pool
+TODO: croak when async_pool triesd to runc anceled thread?
+
+6.39 Mon Jun  2 00:00:08 CEST 2014
+	- work around more incompatible changes in 5.20.
+
+6.38 Sun Jun  1 21:54:23 CEST 2014
+	- check that perl slots actually have enough space to hold
+          interpreter variables.
+	- untested port to perl 5.19 (64 bit tmps indices) (reported
+          by Andreas König).
+	- croak when cancel is called without a thread context.
 
 6.37 Tue Mar  4 13:27:33 CET 2014
-	- *sigh*, removed leftover dbeugging code from debugging a
+	- *sigh*, removed leftover debugging code from debugging a
           perl bug, of all things.
 
 6.36 Tue Mar  4 07:11:59 CET 2014
@@ -132,7 +143,7 @@ TODO: swap_sv not undone in pool
 
 6.01  Sun Jul  3 12:31:14 CEST 2011
 	- workarounds are good, but the test for whether pthreads are used
-          was not good. thisone should be better.
+          was not good. this one should be better.
         - check differently whether gcc generates cfi instructions itself.
 
 6.0   Wed Jun 29 19:43:35 CEST 2011
@@ -140,7 +151,7 @@ TODO: swap_sv not undone in pool
           destroyed and cleaned up automatically (e.g. async { schedule }).
         - implement a JIT compiler for part of the thread switch code,
           which gives a 50% speed improvement on threaded perls, and
-          about 4% on non-thraeded perls (so threaded perls now finally
+          about 4% on non-threaded perls (so threaded perls now finally
           reach about half the speed of non-threaded perls).
         - slightly modernise Coro::Intro, add section about rouse functions.
         - avoid DEFSV and ERRSV, giving another 10% improvement
@@ -69,7 +69,7 @@ use Coro::AnyEvent ();
 
 use base Exporter::;
 
-our $VERSION = 6.37;
+our $VERSION = 6.39;
 
 our @EXPORT    = (@IO::AIO::EXPORT, qw(aio_wait));
 our @EXPORT_OK = @IO::AIO::EXPORT_OK;
@@ -163,7 +163,7 @@ use common::sense;
 use Coro;
 use AnyEvent ();
 
-our $VERSION = 6.37;
+our $VERSION = 6.39;
 
 #############################################################################
 # idle handler
@@ -47,7 +47,7 @@ use Coro::AnyEvent ();
 
 use base Exporter::;
 
-our $VERSION = 6.37;
+our $VERSION = 6.39;
 our $WATCHER;
 
 BDB::set_sync_prepare {
@@ -35,7 +35,7 @@ use common::sense;
 use Coro ();
 use Coro::Semaphore ();
 
-our $VERSION = 6.37;
+our $VERSION = 6.39;
 
 sub DATA (){ 0 }
 sub SGET (){ 1 }
@@ -120,7 +120,7 @@ use Coro::State ();
 use Coro::AnyEvent ();
 use Coro::Timer ();
 
-our $VERSION = 6.37;
+our $VERSION = 6.39;
 
 our %log;
 our $SESLOGLEVEL = exists $ENV{PERL_CORO_DEFAULT_LOGLEVEL} ? $ENV{PERL_CORO_DEFAULT_LOGLEVEL} : -1;
@@ -46,7 +46,7 @@ use AnyEvent::Socket ();
 
 use base 'Exporter';
 
-our $VERSION = 6.37;
+our $VERSION = 6.39;
 our @EXPORT = qw(unblock);
 
 =item $fh = new_from_fh Coro::Handle $fhandle [, arg => value...]
@@ -304,6 +304,8 @@ sub TIEHANDLE {
    $self->[2] = $arg{timeout};
    $self->[3] = "";
    $self->[4] = "";
+   $self->[5] = undef; # work around changes in 5.20, which requires initialisation
+   $self->[6] = undef; # work around changes in 5.20, which requires initialisation
    $self->[7] = $arg{forward_class};
    $self->[8] = $arg{partial};
 
@@ -126,7 +126,7 @@ use Net::HTTP ();
 use Net::FTP ();
 use Net::NNTP ();
 
-our $VERSION = 6.37;
+our $VERSION = 6.39;
 
 *Socket::inet_aton = \&Coro::Util::inet_aton;
 
@@ -7,7 +7,7 @@ use base 'Exporter';
 
 our $installsitearch;
 
-our $VERSION = 6.37;
+our $VERSION = 6.39;
 our @EXPORT_OK = qw(&coro_args $installsitearch);
 
 my %opt;
@@ -38,7 +38,7 @@ use common::sense;
 
 use Coro ();
 
-our $VERSION = 6.37;
+our $VERSION = 6.39;
 
 =item $l = new Coro::RWLock;
 
@@ -67,7 +67,7 @@ use Coro::AnyEvent ();
 
 use base Exporter::;
 
-our $VERSION = 6.37;
+our $VERSION = 6.39;
 our @EXPORT_OK = "select";
 
 sub import {
@@ -42,7 +42,7 @@ use common::sense;
 
 use Coro ();
 
-our $VERSION = 6.37;
+our $VERSION = 6.39;
 
 =item new [inital count]
 
@@ -35,7 +35,7 @@ package Coro::SemaphoreSet;
 
 use common::sense;
 
-our $VERSION = 6.37;
+our $VERSION = 6.39;
 
 use Coro::Semaphore ();
 
@@ -38,7 +38,7 @@ use common::sense;
 
 use Coro::Semaphore ();
 
-our $VERSION = 6.37;
+our $VERSION = 6.39;
 
 =item $sig = new Coro::Signal;
 
@@ -73,7 +73,7 @@ use Coro::Util ();
 
 use base qw(Coro::Handle IO::Socket::INET);
 
-our $VERSION = 6.37;
+our $VERSION = 6.39;
 
 our (%_proto, %_port);
 
@@ -36,7 +36,7 @@ package Coro::Specific;
 
 use common::sense;
 
-our $VERSION = 6.37;
+our $VERSION = 6.39;
 
 =item new
 
@@ -93,7 +93,7 @@ sub warnhook { &$WARNHOOK }
 use XSLoader;
 
 BEGIN {
-   our $VERSION = 6.37;
+   our $VERSION = 6.39;
 
    # must be done here because the xs part expects it to exist
    # it might exist already because Coro::Specific created it.
@@ -2251,6 +2251,9 @@ slf_init_cancel (pTHX_ struct CoroSLF *frame, CV *cv, SV **arg, int items)
     {
       struct coro *self = SvSTATE_current;
 
+      if (!self)
+        croak ("Coro::cancel called outside of thread content,");
+
       /* otherwise we cancel directly, purely for speed reasons
        * unfortunately, this requires some magic trickery, as
        * somebody else could cancel us, so we have to fight the cancellation.
@@ -3444,6 +3447,8 @@ PROTOTYPES: DISABLE
 
 BOOT:
 {
+#define VARx(name,expr,type) if (sizeof (type) < sizeof (expr)) croak ("FATAL: Coro thread context slot '" # name "' too small for this version of perl.");
+#include "state.h"
 #ifdef USE_ITHREADS
 # if CORO_PTHREAD
         coro_thx = PERL_GET_CONTEXT;
@@ -84,7 +84,7 @@ BEGIN {
 use Storable;
 use base "Exporter";
 
-our $VERSION = 6.37;
+our $VERSION = 6.39;
 our @EXPORT = qw(thaw freeze nfreeze blocking_thaw blocking_freeze blocking_nfreeze);
 
 our $GRANULARITY = 0.01;
@@ -28,7 +28,7 @@ use base Exporter::;
 use Coro ();
 use Coro::AnyEvent ();
 
-our $VERSION = 6.37;
+our $VERSION = 6.39;
 our @EXPORT_OK = qw(timeout sleep);
 
 # compatibility with older programs
@@ -41,7 +41,7 @@ use base 'Exporter';
 our @EXPORT = qw(gethostbyname gethostbyaddr);
 our @EXPORT_OK = qw(inet_aton fork_eval);
 
-our $VERSION = 6.37;
+our $VERSION = 6.39;
 
 our $MAXPARALLEL = 16; # max. number of parallel jobs
 
@@ -1,7 +1,7 @@
 /*
  * libecb - http://software.schmorp.de/pkg/libecb
  *
- * Copyright (©) 2009-2013 Marc Alexander Lehmann <libecb@schmorp.de>
+ * Copyright (©) 2009-2014 Marc Alexander Lehmann <libecb@schmorp.de>
  * Copyright (©) 2011 Emanuele Giaquinta
  * All rights reserved.
  *
@@ -25,6 +25,17 @@
  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTH-
  * ERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
  * OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * the GNU General Public License ("GPL") version 2 or any later version,
+ * in which case the provisions of the GPL are applicable instead of
+ * the above. If you wish to allow the use of your version of this file
+ * only under the terms of the GPL and not to allow others to use your
+ * version of this file under the BSD license, indicate your decision
+ * by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL. If you do not delete the
+ * provisions above, a recipient may use your version of this file under
+ * either the BSD or the GPL.
  */
 
 #ifndef ECB_H
@@ -144,6 +155,8 @@
     #elif defined __ARM_ARCH_7__  || defined __ARM_ARCH_7A__  \
        || defined __ARM_ARCH_7M__ || defined __ARM_ARCH_7R__
       #define ECB_MEMORY_FENCE         __asm__ __volatile__ ("dmb"      : : : "memory")
+    #elif __aarch64__
+      #define ECB_MEMORY_FENCE         __asm__ __volatile__ ("dmb ish"  : : : "memory")
     #elif (__sparc || __sparc__) && !__sparcv8
       #define ECB_MEMORY_FENCE         __asm__ __volatile__ ("membar #LoadStore | #LoadLoad | #StoreStore | #StoreLoad" : : : "memory")
       #define ECB_MEMORY_FENCE_ACQUIRE __asm__ __volatile__ ("membar #LoadStore | #LoadLoad"                            : : : "memory")
@@ -594,7 +607,6 @@ ecb_inline ecb_bool ecb_little_endian (void) { return ecb_byteorder_helper () ==
     || __i386 || __i386__ \
     || __amd64 || __amd64__ || __x86_64 || __x86_64__ \
     || __powerpc__ || __ppc__ || __powerpc64__ || __ppc64__ \
-    || defined __arm__ && defined __ARM_EABI__ \
     || defined __s390__ || defined __s390x__ \
     || defined __mips__ \
     || defined __alpha__ \
@@ -603,7 +615,9 @@ ecb_inline ecb_bool ecb_little_endian (void) { return ecb_byteorder_helper () ==
     || defined __m68k__ \
     || defined __m88k__ \
     || defined __sh__ \
-    || defined _M_IX86 || defined _M_AMD64 || defined _M_IA64
+    || defined _M_IX86 || defined _M_AMD64 || defined _M_IA64 \
+    || (defined __arm__ && (defined __ARM_EABI__ || defined __EABI__ || defined __VFP_FP__ || defined _WIN32_WCE || defined __ANDROID__)) \
+    || defined __aarch64__
   #define ECB_STDFP 1
   #include <string.h> /* for memcpy */
 #else
@@ -37,9 +37,9 @@ VAR(savestack_ix,  I32)
 VAR(savestack_max, I32)
 
 VAR(tmps_stack,    SV **)          /* mortals we've made */
-VAR(tmps_ix,       I32)
-VAR(tmps_floor,    I32)
-VAR(tmps_max,      I32)
+VAR(tmps_ix,       SSize_t)
+VAR(tmps_floor,    SSize_t)
+VAR(tmps_max,      SSize_t)
 
 VAR(markstack,     I32 *)          /* stack_sp locations we're remembering */
 VAR(markstack_ptr, I32 *)
@@ -368,7 +368,7 @@ our $idle;    # idle handler
 our $main;    # main coro
 our $current; # current coro
 
-our $VERSION = 6.37;
+our $VERSION = 6.39;
 
 our @EXPORT = qw(async async_pool cede schedule terminate current unblock_sub rouse_cb rouse_wait);
 our %EXPORT_TAGS = (
@@ -795,12 +795,16 @@ bad things can happen, or if the cancelled thread insists on running
 complicated cleanup handlers that rely on its thread context, things will
 not work.
 
-Any cleanup code being run (e.g. from C<guard> blocks) will be run without
-a thread context, and is not allowed to switch to other threads. On the
-plus side, C<< ->cancel >> will always clean up the thread, no matter
-what.  If your cleanup code is complex or you want to avoid cancelling a
-C-thread that doesn't know how to clean up itself, it can be better to C<<
-->throw >> an exception, or use C<< ->safe_cancel >>.
+Any cleanup code being run (e.g. from C<guard> blocks, destructors and so
+on) will be run without a thread context, and is not allowed to switch
+to other threads. A common mistake is to call C<< ->cancel >> from a
+destructor called by die'ing inside the thread to be cancelled for
+example.
+
+On the plus side, C<< ->cancel >> will always clean up the thread, no
+matter what.  If your cleanup code is complex or you want to avoid
+cancelling a C-thread that doesn't know how to clean up itself, it can be
+better to C<< ->throw >> an exception, or use C<< ->safe_cancel >>.
 
 The arguments to C<< ->cancel >> are not copied, but instead will
 be referenced directly (e.g. if you pass C<$var> and after the call
@@ -816,11 +820,12 @@ Coro object.
 
 Works mostly like C<< ->cancel >>, but is inherently "safer", and
 consequently, can fail with an exception in cases the thread is not in a
-cancellable state.
+cancellable state. Essentially, C<< ->safe_cancel >> is a C<< ->cancel >>
+with extra checks before canceling.
 
-This method works a bit like throwing an exception that cannot be caught
-- specifically, it will clean up the thread from within itself, so
-all cleanup handlers (e.g. C<guard> blocks) are run with full thread
+It works a bit like throwing an exception that cannot be caught -
+specifically, it will clean up the thread from within itself, so all
+cleanup handlers (e.g. C<guard> blocks) are run with full thread
 context and can block if they wish. The downside is that there is no
 guarantee that the thread can be cancelled when you call this method, and
 therefore, it might fail. It is also considerably slower than C<cancel> or
@@ -60,7 +60,7 @@ use EV ();
 use XSLoader;
 
 BEGIN {
-   our $VERSION = 6.37;
+   our $VERSION = 6.39;
 
    local $^W = 0; # avoid redefine warning for Coro::ready;
    XSLoader::load __PACKAGE__, $VERSION;
@@ -92,7 +92,7 @@ use base Exporter::;
 our @EXPORT = qw(loop unloop sweep);
 
 BEGIN {
-   our $VERSION = 6.37;
+   our $VERSION = 6.39;
 
    local $^W = 0; # avoid redefine warning for Coro::ready;
    XSLoader::load __PACKAGE__, $VERSION;
@@ -4,7 +4,7 @@
       "unknown"
    ],
    "dynamic_config" : 1,
-   "generated_by" : "ExtUtils::MakeMaker version 6.86, CPAN::Meta::Converter version 2.133380",
+   "generated_by" : "ExtUtils::MakeMaker version 6.98, CPAN::Meta::Converter version 2.140640",
    "license" : [
       "unknown"
    ],
@@ -50,5 +50,5 @@
       }
    },
    "release_status" : "stable",
-   "version" : "6.37"
+   "version" : 6.39
 }
@@ -3,32 +3,32 @@ abstract: unknown
 author:
   - unknown
 build_requires:
-  ExtUtils::MakeMaker: 0
+  ExtUtils::MakeMaker: '0'
 configure_requires:
-  ExtUtils::MakeMaker: 0
+  ExtUtils::MakeMaker: '0'
 dynamic_config: 1
-generated_by: 'ExtUtils::MakeMaker version 6.86, CPAN::Meta::Converter version 2.133380'
+generated_by: 'ExtUtils::MakeMaker version 6.98, CPAN::Meta::Converter version 2.140640'
 license: unknown
 meta-spec:
   url: http://module-build.sourceforge.net/META-spec-v1.4.html
-  version: 1.4
+  version: '1.4'
 name: Coro
 no_index:
   directory:
     - t
     - inc
 recommends:
-  AnyEvent: 7
-  AnyEvent::AIO: 1
-  AnyEvent::BDB: 1
-  BDB: 0
-  EV: 4
-  Event: 1.08
-  IO::AIO: 3.1
+  AnyEvent: '7'
+  AnyEvent::AIO: '1'
+  AnyEvent::BDB: '1'
+  BDB: '0'
+  EV: '4'
+  Event: '1.08'
+  IO::AIO: '3.1'
 requires:
-  AnyEvent: 5
-  Guard: 0.5
-  Scalar::Util: 0
-  Storable: 2.15
-  common::sense: 0
-version: 6.37
+  AnyEvent: '5'
+  Guard: '0.5'
+  Scalar::Util: '0'
+  Storable: '2.15'
+  common::sense: '0'
+version: 6.39
@@ -663,13 +663,16 @@ CORO OBJECT METHODS
         on running complicated cleanup handlers that rely on its thread
         context, things will not work.
 
-        Any cleanup code being run (e.g. from "guard" blocks) will be run
-        without a thread context, and is not allowed to switch to other
-        threads. On the plus side, "->cancel" will always clean up the
-        thread, no matter what. If your cleanup code is complex or you want
-        to avoid cancelling a C-thread that doesn't know how to clean up
-        itself, it can be better to "->throw" an exception, or use
-        "->safe_cancel".
+        Any cleanup code being run (e.g. from "guard" blocks, destructors
+        and so on) will be run without a thread context, and is not allowed
+        to switch to other threads. A common mistake is to call "->cancel"
+        from a destructor called by die'ing inside the thread to be
+        cancelled for example.
+
+        On the plus side, "->cancel" will always clean up the thread, no
+        matter what. If your cleanup code is complex or you want to avoid
+        cancelling a C-thread that doesn't know how to clean up itself, it
+        can be better to "->throw" an exception, or use "->safe_cancel".
 
         The arguments to "->cancel" are not copied, but instead will be
         referenced directly (e.g. if you pass $var and after the call change
@@ -684,15 +687,16 @@ CORO OBJECT METHODS
     $coro->safe_cancel ($arg...)
         Works mostly like "->cancel", but is inherently "safer", and
         consequently, can fail with an exception in cases the thread is not
-        in a cancellable state.
-
-        This method works a bit like throwing an exception that cannot be
-        caught - specifically, it will clean up the thread from within
-        itself, so all cleanup handlers (e.g. "guard" blocks) are run with
-        full thread context and can block if they wish. The downside is that
-        there is no guarantee that the thread can be cancelled when you call
-        this method, and therefore, it might fail. It is also considerably
-        slower than "cancel" or "terminate".
+        in a cancellable state. Essentially, "->safe_cancel" is a "->cancel"
+        with extra checks before canceling.
+
+        It works a bit like throwing an exception that cannot be caught -
+        specifically, it will clean up the thread from within itself, so all
+        cleanup handlers (e.g. "guard" blocks) are run with full thread
+        context and can block if they wish. The downside is that there is no
+        guarantee that the thread can be cancelled when you call this
+        method, and therefore, it might fail. It is also considerably slower
+        than "cancel" or "terminate".
 
         A thread is in a safe-cancellable state if it either hasn't been run
         yet, or it has no C context attached and is inside an SLF function.