mirror of
https://github.com/danog/amp.git
synced 2024-11-27 04:24:42 +01:00
30 lines
496 B
PHP
30 lines
496 B
PHP
<?php
|
|
|
|
namespace Amp\Loop;
|
|
|
|
use AsyncInterop\Loop\DriverFactory;
|
|
|
|
/**
|
|
* Default loop factory for Amp.
|
|
*/
|
|
class LoopFactory implements DriverFactory {
|
|
/**
|
|
* {@inheritdoc}
|
|
*/
|
|
public function create() {
|
|
if (UvLoop::supported()) {
|
|
return new UvLoop;
|
|
}
|
|
|
|
if (EvLoop::supported()) {
|
|
return new EvLoop;
|
|
}
|
|
|
|
if (EventLoop::supported()) {
|
|
return new EventLoop;
|
|
}
|
|
|
|
return new NativeLoop;
|
|
}
|
|
}
|