1
0
mirror of https://github.com/danog/parallel.git synced 2024-11-27 12:54:55 +01:00

Remove static variable limitation

pthreads 3 supports closures with static variables in threads
This commit is contained in:
Aaron Piotrowski 2016-01-27 01:23:50 -06:00
parent ae7ec0529c
commit b8973fced0

View File

@ -91,14 +91,6 @@ class Thread implements Strand
throw new UnsupportedError("The pthreads extension is required to create threads.");
}
// Make sure closures don't `use` other variables or have statics.
if ($function instanceof \Closure) {
$reflector = new \ReflectionFunction($function);
if (!empty($reflector->getStaticVariables())) {
throw new InvalidArgumentError('Closures with static variables cannot be passed to thread.');
}
}
$this->function = $function;
$this->args = $args;
}