mirror of
https://github.com/danog/asyncConstruct.git
synced 2024-11-26 18:54:38 +01:00
35 lines
640 B
PHP
35 lines
640 B
PHP
<?php
|
|
|
|
/**
|
|
* Blocking wakeup trait.
|
|
*
|
|
* @author Daniil Gentili <daniil@daniil.it>
|
|
* @copyright 2016-2020 Daniil Gentili <daniil@daniil.it>
|
|
* @license https://opensource.org/licenses/MIT MIT
|
|
*/
|
|
|
|
namespace danog;
|
|
|
|
/**
|
|
* Blocking wakeup trait.
|
|
*
|
|
* Manages blocking wakeup of async classes
|
|
*
|
|
* @author Daniil Gentili <daniil@daniil.it>
|
|
*/
|
|
trait BlockingWakeup
|
|
{
|
|
use AsyncWakeup;
|
|
|
|
/**
|
|
* Wakeup function.
|
|
*/
|
|
public function __wakeup(): void
|
|
{
|
|
if (\method_exists($this, '__wakeup_async')) {
|
|
$this->setWakeupPromise($this->__wakeup_async());
|
|
}
|
|
$this->wakeup();
|
|
}
|
|
}
|