title: What does send/recv/begin/end mean for AnyEvent's condvar?
body: <p>I'm at a loss what it means, though I'm read several examples on it:</p>
  
  <pre><code>#!/usr/bin/perl
  use strict;
  use AnyEvent;
  
  my $cv = AnyEvent-&gt;condvar( cb =&gt; sub {
      warn "done";
  });
  
  for my $i (1..10) {
      $cv-&gt;begin;
      my $w; $w = AnyEvent-&gt;timer(after =&gt; $i, cb =&gt; sub {
      warn "finished timer $i";
      undef $w;
      $cv-&gt;end;
      });
  }
  
  $cv-&gt;recv;
  </code></pre>
  
  <p>Can anyone explain in more detail what <code>send/recv/begin/end</code> does?</p>
  
  <p><strong>UPDATE</strong></p>
  
  <pre><code>my $i = 1;
  my $s = sub {
      print $i;
  };
  my $i = 10;
  $s-&gt;();  # 1
  </code></pre>