Event loop for handling notifications from multiple threads at once
LGPL-3.0 License
ext-pmmpthread
6.0 or newer is now required.SleeperHandler::addNotifier()
now returns SleeperHandlerEntry
. This is a thread-safe object used to create SleeperNotifier
, and should be passed to the destination thread.SleeperHandler::addNotifier()
no longer accepts SleeperNotifier
. Notifiers are now created using SleeperHandlerEntry::createNotifier()
.SleeperHandler::removeNotifier()
now accepts int $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 using SleeperHandlerEntry::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.Published by dktapps almost 2 years ago
Published by dktapps almost 3 years ago
Published by dktapps almost 3 years ago
Published by dktapps over 3 years ago
SleeperHandler
now only accepts Closure
for handlers, not callable
. (You can use Closure::fromCallable()
to convert a callable to a closure.)SleeperNotifier->wakeupSleeper()
(less locking).SleeperHandler
no longer keeps references to SleeperNotifier
instances (not needed). NotifierEntry
has therefore been removed.Published by dktapps over 3 years ago