PocketMine-MP 5.15.1 git-5ef247620a7c6301a849b54e5ef1009217729fc8
pocketmine\snooze\SleeperHandlerEntry Class Reference
+ Inheritance diagram for pocketmine\snooze\SleeperHandlerEntry:
+ Collaboration diagram for pocketmine\snooze\SleeperHandlerEntry:

Public Member Functions

 __construct (private readonly ThreadSafeArray $sharedObject, private readonly int $id)
 
 createNotifier ()
 
 getNotifierId ()
 

Detailed Description

Represents an entry in a SleeperHandler. This is used to unregister the notifier when it is no longer needed. It is also used to create the SleeperNotifier for the thread that needs to do wakeups.

Since notifiers themselves are not shared between threads, they don't need to be thread-safe. We only need to pass the information needed to construct the notifier to the destination thread. This approach maximizes performance by avoiding unnecessary overhead of extra ThreadSafe objects.

Pass this object into the thread that needs to do wakeups, and then create a notifier using SleeperHandlerEntry::createNotifier().

Obtain this by calling SleeperHandler::addNotifier().

Definition at line 33 of file SleeperHandlerEntry.php.

Constructor & Destructor Documentation

◆ __construct()

pocketmine\snooze\SleeperHandlerEntry::__construct ( private readonly ThreadSafeArray  $sharedObject,
private readonly int  $id 
)

Definition at line 41 of file SleeperHandlerEntry.php.

Member Function Documentation

◆ createNotifier()

pocketmine\snooze\SleeperHandlerEntry::createNotifier ( )

Constructs a notifier for this entry. Call this inside the thread that needs to do wakeups to get a notifier instance.

Definition at line 54 of file SleeperHandlerEntry.php.

◆ getNotifierId()

pocketmine\snooze\SleeperHandlerEntry::getNotifierId ( )
final

Definition at line 46 of file SleeperHandlerEntry.php.


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