1
0
mirror of https://github.com/danog/loop.git synced 2024-12-12 09:19:45 +01:00
loop/lib/Interfaces/ResumableLoopInterface.php

43 lines
1.0 KiB
PHP
Raw Normal View History

2020-07-21 18:06:19 +02:00
<?php
/**
* Resumable loop interface.
*
* @author Daniil Gentili <daniil@daniil.it>
* @copyright 2016-2020 Daniil Gentili <daniil@daniil.it>
* @license https://opensource.org/licenses/MIT MIT
*/
2020-07-21 21:45:22 +02:00
namespace danog\Loop\Interfaces;
2020-07-21 18:06:19 +02:00
use Amp\Promise;
/**
* Resumable loop interface.
*
* @author Daniil Gentili <daniil@daniil.it>
*/
interface ResumableLoopInterface extends LoopInterface
{
/**
* Pause the loop.
*
* @param int|float|null $time For how long to pause the loop, if null will pause forever (until resume is called from outside of the loop)
*
* @return Promise Resolved when the loop is resumed
*/
public function pause($time = null): Promise;
/**
* Resume the loop.
*
* @return Promise Resolved when the loop is paused again
*/
public function resume(): Promise;
2020-07-21 19:41:17 +02:00
/**
* Defer resuming the loop to next tick.
*
* @return Promise Resolved when the loop is paused again
*/
public function resumeDefer(): Promise;
2020-07-21 18:06:19 +02:00
}