An open API service indexing awesome lists of open source software.

https://github.com/bileto/criticalsection

Lightweight class supporting critical section locking
https://github.com/bileto/criticalsection

critical-section locks parallel

Last synced: 10 months ago
JSON representation

Lightweight class supporting critical section locking

Awesome Lists containing this project

README

          

# Critical Sections for PHP [![Build Status](https://travis-ci.org/bileto/CriticalSection.svg?branch=master)](https://travis-ci.org/bileto/CriticalSection)

## Description

Lightweight class supporting critical section locking in PHP.

It requires **PHP >= 7.1** and no other dependency.

## Example

```php
$pdo = new PDO('...');
$driver = new Bileto\CriticalSection\Driver\PdoPgsqlDriver($pdo);
$criticalSection = new Bileto\CriticalSection\CriticalSection($driver);

$criticalSection->enter('Section Label');

// Perform set of steps of critical tasks

$criticalSection->leave('Section Label');
```