Releases: pmmp/Snooze
Releases · pmmp/Snooze
0.5.0
Changes since 0.4.x
General
- PHP 8.1 or newer is now required.
ext-pmmpthread
6.0 or newer is now required.
API changes
SleeperHandler::addNotifier()
now returnsSleeperHandlerEntry
. This is a thread-safe object used to createSleeperNotifier
, and should be passed to the destination thread.SleeperHandler::addNotifier()
no longer acceptsSleeperNotifier
. Notifiers are now created usingSleeperHandlerEntry::createNotifier()
.SleeperHandler::removeNotifier()
now acceptsint $notifierId
. This allows the main thread to retain only the notifier ID for later cleanup, saving memory.SleeperNotifier
is no longer thread-safe, and must be instantiated within the destination thread usingSleeperHandlerEntry::createNotifier()
. Since the notification delivery does not require the notifier itself to be a thread-safe object, this allows for better performance by avoiding unnecessary locking and the inherent overhead of thread-safe objects.
0.4.0
0.3.1
0.1.6
0.3.0
Changes since 0.2.0
SleeperHandler
now only acceptsClosure
for handlers, notcallable
. (You can useClosure::fromCallable()
to convert a callable to a closure.)- Improved performance of
SleeperNotifier->wakeupSleeper()
(less locking). SleeperHandler
no longer keeps references toSleeperNotifier
instances (not needed).NotifierEntry
has therefore been removed.
0.2.0
Changes since 0.1.5
- The use of a thread-safe map for tracking notifications (instead of flags on each notifier) improves performance substantially:
- Notification processing with large numbers of notifiers is much faster, since it's not required to synchronize with and bruteforce-search for notifiers causing a wakeup (less locks, and also less CPU time wasted).
- Less locks are required during delivery of notifications (locks only required on the shared object and not on notifiers).