Skip to content

Instantly share code, notes, and snippets.

Created June 5, 2014 07:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/bf3a3f276f060fe58942 to your computer and use it in GitHub Desktop.
Save anonymous/bf3a3f276f060fe58942 to your computer and use it in GitHub Desktop.
use v5.10;
use Mojo::IOLoop;
say EV::now;
say localtime.': sleeping 5...';
sleep(2);
Mojo::IOLoop->one_tick; # updates EV::now
say EV::now;
say localtime.': register 5 sec timeout...';
Mojo::IOLoop->timer(2 => sub { say localtime.': timeout!'; shift->stop; });
say localtime.': starting ioloop...';
Mojo::IOLoop->start();
say localtime.': done';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment