PocketMine-MP 5.21.2 git-b2aa6396c3cc2cafdd815eacc360e1ad89599899
|
Public Member Functions | |
__construct (private readonly ThreadSafeArray $sharedObject, private readonly int $id) | |
createNotifier () | |
getNotifierId () | |
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.
pocketmine\snooze\SleeperHandlerEntry::__construct | ( | private readonly ThreadSafeArray | $sharedObject, |
private readonly int | $id ) |
Definition at line 41 of file SleeperHandlerEntry.php.
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.
|
final |
Definition at line 46 of file SleeperHandlerEntry.php.