Skip to content

Instantly share code, notes, and snippets.

/ev.diff Secret

Created June 9, 2016 14:02
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/0b964fd576a6b0f4c58257f353784321 to your computer and use it in GitHub Desktop.
Save anonymous/0b964fd576a6b0f4c58257f353784321 to your computer and use it in GitHub Desktop.
diff --git a/lib/Mojo/Reactor.pm b/lib/Mojo/Reactor.pm
index ea11032..64d226b 100644
--- a/lib/Mojo/Reactor.pm
+++ b/lib/Mojo/Reactor.pm
@@ -2,12 +2,14 @@ package Mojo::Reactor;
use Mojo::Base 'Mojo::EventEmitter';
use Carp 'croak';
+use Config;
use Mojo::Loader 'load_class';
sub again { croak 'Method "again" not implemented by subclass' }
sub detect {
- my $try = $ENV{MOJO_REACTOR} || 'Mojo::Reactor::EV';
+ my $default = 'Mojo::Reactor::' . ($Config{d_pseudofork} ? 'Poll' : 'EV');
+ my $try = $ENV{MOJO_REACTOR} || $default;
return load_class($try) ? 'Mojo::Reactor::Poll' : $try;
}
diff --git a/lib/Mojo/Reactor/EV.pm b/lib/Mojo/Reactor/EV.pm
index 9cbc844..5d126ed 100644
--- a/lib/Mojo/Reactor/EV.pm
+++ b/lib/Mojo/Reactor/EV.pm
@@ -6,8 +6,6 @@ use EV 4.0;
my $EV;
-sub CLONE { die "EV does not work with ithreads.\n" }
-
sub DESTROY { undef $EV }
sub again {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment