PHPackages                             azjezz/mutex - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. azjezz/mutex

ActiveLibrary

azjezz/mutex
============

Mutex Locking for hack projects

1.0.0(7y ago)12[2 issues](https://github.com/azjezz/mutex/issues)MITHack

Since Mar 1Pushed 5y ago1 watchersCompare

[ Source](https://github.com/azjezz/mutex)[ Packagist](https://packagist.org/packages/azjezz/mutex)[ RSS](/packages/azjezz-mutex/feed)WikiDiscussions master Synced today

READMEChangelog (1)Dependencies (6)Versions (3)Used By (0)

Mutex
=====

[](#mutex)

Hack implementation of [`reactphp-muxted`](https://github.com/WyriHaximus/reactphp-mutex) by [WyriHaximus](https://github.com/WyriHaximus).

[![Build Status](https://camo.githubusercontent.com/4b39b2f756fa6e68d210b247f88b706b70c798f5b1a2553d3f316210962eb97a/68747470733a2f2f7472617669732d63692e6f72672f617a6a657a7a2f6d757465782e7376673f6272616e63683d6d6173746572)](https://travis-ci.com/azjezz/mutex)[![Latest Stable Version](https://camo.githubusercontent.com/9878be2afc7d9841fbfed1c190eaf682e5f5ae221020743dbbf19dd191ff99c4/68747470733a2f2f706f7365722e707567782e6f72672f617a6a657a7a2f6d757465782f762f737461626c652e706e673f)](https://packagist.org/packages/azjezz/mutex)[![Total Downloads](https://camo.githubusercontent.com/5901185f27a56522a37f089011aa20e9a36569450c782f2e1a2a0d0f5ad1d244/68747470733a2f2f706f7365722e707567782e6f72672f617a6a657a7a2f6d757465782f646f776e6c6f6164732e706e673f)](https://packagist.org/packages/azjezz/mutex)[![License](https://camo.githubusercontent.com/a210fe7ba67bd7b0e37030eb39b718534ab2b6f1ae1ed362eb9aeda16af37db3/68747470733a2f2f706f7365722e707567782e6f72672f617a6a657a7a2f6d757465782f6c6963656e73652e706e673f)](https://packagist.org/packages/azjezz/mutex)

---

Install
-------

[](#install)

To install via Composer, use the command below :

```
composer require azjezz/mutex
```

About
-----

[](#about)

This package provides two things:

- An interface for [`mutex` locking](https://en.wikipedia.org/wiki/Mutual_exclusion)
- A in-memory implementation of that interface

Example
-------

[](#example)

```
use namespace AzJezz\Mutex;
use namespace HH\Asio;

require 'vendor/autoload.hack';

async function main(): Awaitable {
  Facebook\AutoloadMap\initialize();

  $mutex = new Mutex\Memory();

  $jobs = vec[
    foo($mutex), // first to acquire the lock
    foo($mutex), // won't be able to acquire the lock
    foo($mutex), // same
  ];

  foreach($jobs as $job) {
    await $job;
  }
}

async function foo(
  Mutex\MutexInterface $mutex
): Awaitable {
  $lock = await $mutex->acquire('foo');
  if ($lock is nonnull) {
    echo "doing things \n";
    await Asio\usleep(10000000);
    echo "finished my job, releasing the lock \n";
    await $mutex->release($lock);
    return;
  }

  echo "someone else have requested the 'foo' lock\n";
}
```

License
-------

[](#license)

The Mutex Project is open-sourced software licensed under the MIT-licensed.

###  Health Score

21

—

LowBetter than 19% of packages

Maintenance0

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity61

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

2626d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/8489d7c85bfa7c637b8e13484f3f659652aea0568b6e7f9e66edeb0649b5a2f1?d=identicon)[azjezz](/maintainers/azjezz)

---

Top Contributors

[![azjezz](https://avatars.githubusercontent.com/u/29315886?v=4)](https://github.com/azjezz "azjezz (4 commits)")

---

Tags

hackhacklanghhvmmutexmutex-lockmutual-exclusion

### Embed Badge

![Health badge](/badges/azjezz-mutex/health.svg)

```
[![Health](https://phpackages.com/badges/azjezz-mutex/health.svg)](https://phpackages.com/packages/azjezz-mutex)
```

###  Alternatives

[quizlet/hammock

Hammock is a stand-alone mocking library for Hacklang.

27445.5k](/packages/quizlet-hammock)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
