Skip to content

extents Process vs implements Runnable #11

@shtse8

Description

@shtse8

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);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions