simple-fork-php
simple-fork-php copied to clipboard
extents Process vs implements Runnable
Any different between these two codes:
class TestRunnable implements Runnable
{
private $id = 0;
public function __construct($id) {
$this->id = $id;
}
public function run()
{
echo "[".$this->id."]\n";
sleep(1);
}
}
new Process(new TestRunnable(1));
and
class TestProcess extends Process
{
private $id = 0;
public function __construct($id) {
$this->id = $id;
}
public function run()
{
echo "[".$this->id."]\n";
sleep(1);
}
}
new TestProcess (1);