2017 © Pedro Peláez
 

symfony-bundle semaphore-bundle

This is a Symfony2 bundle that provides a semaphore system.

image

kitpages/semaphore-bundle

This is a Symfony2 bundle that provides a semaphore system.

  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 4 Forks
  • 1 Open issues
  • 9 Versions
  • 0 % Grown

The README.md

KitpagesSemaphoreBundle

Build Status, (*1)

SensioLabsInsight, (*2)

This bundle allows a protection between several parallel php process accessing a single resource, (*3)

quick start

// get manager
$semaphoreManager = $this->get("kitpages_semaphore.manager");

// wait for the semaphore disponibility
$semaphoreManager->aquire("my_semaphore_name");

// do someting interesting with the protected resource

// release the semaphore
$semaphoreManager->release("my_semaphore_name");

Features

  • shared semaphore between several parallel php processes (using the filesystem)
  • deadlock detection : consider a semaphore as dead after a configurable duration
  • logging system for deadlock on a specific channel in monolog (channel : kitpages_semaphore)
  • stopwatch to see semaphore usage in the timeline of the symfony debug toolbar

## Installation

Using Composer, just $ composer require kitpages/semaphore-bundle package or:, (*4)

{
  "require": {
    "kitpages/semaphore-bundle": "~1.4"
  }
}

Then add the bundle in AppKernel :, (*5)

    public function registerBundles()
    {
        $bundles = array(
            // ...
            // use of monolog
            new Symfony\Bundle\MonologBundle\MonologBundle(),
            // the bundle itself
            new Kitpages\SemaphoreBundle\KitpagesSemaphoreBundle(),
        );
    }

The add configuration in your config.yml., (*6)

Default values are 0.1s for pooling sleep time and 5s for deadlock duration, (*7)

kitpages_semaphore:
    sleep_time_microseconds: 100000
    dead_lock_microseconds: 5000000

Status

  • stable, tested and under travis-ci

Versions

2014-02-11 : v1.4.0 : addded semaphore usage in the timeline of the SF2 debug toolbar, (*8)

  • no BC break
  • new : added stopwatch to add semaphore usage in the timeline of the SF2 debug toolbar
  • new : debug log less verbose
  • new : warning log added on release on a not locked semaphore

2014-01-22 : v1.3.0 : refactoring based on file lock, (*9)

  • no BC break
  • used file lock instead of SQL transaction

2014-01-14 : v1.2.0 : logger for dead lock, (*10)

  • no BC break
  • new : use monolog on the channel "kitpages_semaphore" to send a warning for every deadlock
  • fix : dependencies in composer.json
  • enh : more unit testing for configuration parser and service initialisation in the DIC
  • enh : Readme rewriting

2013-12-11 : v1.1.0 : atomicity in aquire-release process, (*11)

  • no BC Break
  • new : add a db transaction around the aquire-release process to garanty atomicity

2013-12-05 : v1.0.0 : first release, (*12)

The Versions

11/02 2014

v1.4.0

1.4.0.0 https://github.com/kitpages/KitpagesSemaphoreBundle

This is a Symfony2 bundle that provides a semaphore system.

  Sources   Download

MIT

The Requires

 

The Development Requires

lock semaphore

22/01 2014

v1.3.0

1.3.0.0 https://github.com/kitpages/KitpagesSemaphoreBundle

This is a Symfony2 bundle that provides a semaphore system.

  Sources   Download

MIT

The Requires

 

The Development Requires

lock semaphore

11/12 2013

v1.1.0

1.1.0.0 https://github.com/kitpages/KitpagesSemaphoreBundle

This is a Symfony2 bundle that provides a semaphore system.

  Sources   Download

MIT

The Requires

 

The Development Requires

lock semaphore

05/12 2013

v1.0.0

1.0.0.0 https://github.com/kitpages/KitpagesSemaphoreBundle

This is a Symfony2 bundle that provides a semaphore system.

  Sources   Download

MIT

The Requires

 

The Development Requires

lock semaphore