1
0
mirror of https://github.com/danog/parallel.git synced 2024-11-26 20:34:40 +01:00

Continue using pthreads for workers

Will consider removing in the future, but a deprecation period should come before.
This commit is contained in:
Aaron Piotrowski 2019-02-18 09:41:56 -06:00
parent f919371aee
commit a9a5807798
No known key found for this signature in database
GPG Key ID: ADD1EF783EDE9EEB

View File

@ -3,6 +3,7 @@
namespace Amp\Parallel\Worker;
use Amp\Parallel\Context\Parallel;
use Amp\Parallel\Context\Thread;
/**
* The built-in worker factory type.
@ -44,10 +45,12 @@ final class DefaultWorkerFactory implements WorkerFactory
public function create(): Worker
{
if (Parallel::isSupported()) {
return new WorkerThread($this->className);
return new WorkerParallel($this->className);
}
// Thread context is not use as pthreads is deprecated.
if (Thread::isSupported()) {
return new WorkerThread($this->className);
}
return new WorkerProcess(
$this->className,