WP Manifestindependent plugin directory
manifest / developer / dw-semaphore

DW Semaphore

A semaphore implementation for Wordpress

★ 2stars

Install

Download source zip No release zip yet

This is the repository archive. It installs, but the folder name will carry the branch suffix and updates will not flow.

Install straight from GitHub with WP-CLI:

wp plugin install https://github.com/dwilmer/dw-semaphore/archive/refs/heads/master.zip
No built-in updater. New versions won't appear under Dashboard → Updates. Install new releases yourself, or let Git Updater track the repository.
dwsemaphore A semaphore implementation for Wordpress to facilitate mutual exclusivity. See wikipedia) for more information on semaphores. Repo on github. Basic Usage 1. Download and enable the plugin 2. Whenever there is an aread of code that requires mutual exclusivity (i.e. only one process/thread at a time should be able to run that piece of code), start that code using $semaphore = DWSemaphore::wait($name). When that code is finished, call $semaphore-signal() to signal that it's done. 3. Notes for performance: - All semaphores of the same name will wait for eachother. Only use the same name if you need all those semaphores to be mutually exclusive; use unique names where possible to avoid semaphores waiting on eachother needlessly. - Keep the time between DWSemaphore::wait() and $semaphore-signal as short as possible, as other processes might be waiting. If you need a unique value and then do something with it, only make the generation of this unique value mutually exclusive and let the processing of that value be possible parallel. 4. Final note: while this plugin is designed to provide mutual exclusivity, semaphores can expire in case a process never signals. The curre