Socket
Book a DemoInstallSign in
Socket

bare-atomics

Package Overview
Dependencies
Maintainers
2
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bare-atomics

Native synchronization primitives for JavaScript

latest
Source
npmnpm
Version
3.0.7
Version published
Weekly downloads
6
Maintainers
2
Weekly downloads
 
Created
Source

bare-atomics

Native synchronization primitives for JavaScript.

npm i bare-atomics

API

Mutex

const mutex = new Mutex([options])

Options include:

{
  recursive: false
}

const mutex = Mutex.from(handle[, options])

Options are the same as new Mutex().

mutex.handle

A SharedArrayBuffer with the underlying mutex handle.

mutex.held

Whether or not the current thread currently holds the mutex.

mutex.lock()

const success = mutex.tryLock()

mutex.unlock()

mutex.destroy()

Semaphore

const semaphore = new Semaphore(value)

const semaphore = Semaphore.from(handle)

semaphore.handle

A SharedArrayBuffer with the underlying semaphore handle.

semaphore.wait()

const success = semaphore.tryWait()

semaphore.post()

semaphore.destroy()

Condition

const condition = new Condition()

const condition = Condition.from(handle)

condition.handle

A SharedArrayBuffer with the underlying condition handle.

const success = condition.wait(mutex[, timeout])

condition.signal()

condition.broadcast()

condition.destroy()

Barrier

const barrier = new Barrier(count)

const barrier = Barrier.from(handle)

barrier.handle

A SharedArrayBuffer with the underlying barrier handle.

const success = barrier.wait()

barrier.destroy()

License

Apache-2.0

FAQs

Package last updated on 14 Aug 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts