DesignPatternsPHP/Pool/Worker.php
2014-04-08 11:29:18 +02:00

22 lines
400 B
PHP

<?php
namespace DesignPatterns\Pool;
class Worker
{
public function __construct()
{
// let say that constuctor does really expensive work...
// for example creates "thread"
}
public function run($image, array $callback)
{
// do something with $image...
// and when it's done, execute callback
call_user_func($callback, $this);
}
}