our @EXPORT = qw(future await_future await_all);
+sub _log { printf "[%s] %s\n", scalar(localtime), join '', @_ }
+
sub future (&;$) {
my $f = $_[0]->(CPS::Future->new);
return $f if ((caller(1+($_[1]||0))||'') eq 'start');
sub await_future {
my $f = shift;
+ _log(sprintf "got $f: [%s]", $f->is_ready);
return $f if $f->is_ready;
require Object::Remote;
my $loop = Object::Remote->current_loop;
has _timers => (is => 'ro', default => sub { [] });
+sub _log { shift; printf "[%s] %s\n", scalar(localtime), join '', @_ }
+
sub pass_watches_to {
my ($self, $new_loop) = @_;
foreach my $fh ($self->_read_select->handles) {
# differentiate between an error and a timeout.
# -- no, love, mst.
foreach my $fh (@$readable) {
+ $self->_log("got a readable: $fh");
$read->{$fh}() if $read->{$fh};
}
foreach my $fh (@$writeable) {