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:
parent
ae7ec0529c
commit
b8973fced0
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user