WP Manifestindependent plugin directory
manifest / developer / dw-semaphore

DW Semaphore

A semaphore implementation for Wordpress

by Daan Wilmer · github.com/dwilmer/dw-semaphore

2stars
0forks

Install

No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:

wp plugin install https://github.com/dwilmer/dw-semaphore/archive/refs/heads/master.zip

From the readme

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

Read the full README on GitHub →