mirror of
https://github.com/DesignPatternsPHP/DesignPatternsPHP.git
synced 2025-06-02 12:04:51 +02:00
22 lines
400 B
PHP
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);
|
|
}
|
|
|
|
}
|