PocketMine-MP 5.21.2 git-b2aa6396c3cc2cafdd815eacc360e1ad89599899
Loading...
Searching...
No Matches
pocketmine\snooze\SleeperHandler Class Reference
+ Inheritance diagram for pocketmine\snooze\SleeperHandler:
+ Collaboration diagram for pocketmine\snooze\SleeperHandler:

Public Member Functions

 addNotifier (\Closure $handler)
 
 processNotifications ()
 
 removeNotifier (int $notifierId)
 
 sleepUntil (float $unixTime)
 
 sleepUntilNotification ()
 

Detailed Description

Manages a Threaded sleeper which can be waited on for notifications. Calls callbacks for attached notifiers when notifications are received from the notifiers.

Definition at line 25 of file SleeperHandler.php.

Constructor & Destructor Documentation

◆ __construct()

pocketmine\snooze\SleeperHandler::__construct ( )

Definition at line 40 of file SleeperHandler.php.

Member Function Documentation

◆ addNotifier()

pocketmine\snooze\SleeperHandler::addNotifier ( \Closure $handler)
Parameters
\Closure$handlerCalled when the notifier wakes the server up, of the signature function() : void @phpstan-param \Closure() : void $handler

Reimplemented in pocketmine\TimeTrackingSleeperHandler.

Definition at line 48 of file SleeperHandler.php.

◆ processNotifications()

pocketmine\snooze\SleeperHandler::processNotifications ( )

Processes any notifications from notifiers and calls handlers for received notifications.

Reimplemented in pocketmine\TimeTrackingSleeperHandler.

Definition at line 102 of file SleeperHandler.php.

◆ removeNotifier()

pocketmine\snooze\SleeperHandler::removeNotifier ( int $notifierId)

Removes a callback from the sleeper by its ID. Note that this does not prevent the notifier waking the sleeper up - it just stops the notifier getting actions processed from the main thread.

See also
SleeperHandlerEntry::getNotifierId()

Definition at line 61 of file SleeperHandler.php.

◆ sleepUntil()

pocketmine\snooze\SleeperHandler::sleepUntil ( float $unixTime)

Sleeps until the given timestamp. Sleep may be interrupted by notifications, which will be processed before going back to sleep.

Definition at line 77 of file SleeperHandler.php.

◆ sleepUntilNotification()

pocketmine\snooze\SleeperHandler::sleepUntilNotification ( )

Blocks until notifications are received, then processes notifications. Will not sleep if notifications are already waiting.

Definition at line 94 of file SleeperHandler.php.


The documentation for this class was generated from the following file: