Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback
Module

x/async/mod.ts>Semaphore#lock

🦕 Asynchronous primitive modules loosely port from Python's asyncio for Deno.
Go to Latest
method Semaphore.prototype.lock
import { Semaphore } from "https://deno.land/x/async@v2.0.0/mod.ts";

Acquires a lock on the semaphore, and invokes the specified function.

Parameters

f: () => R | PromiseLike<R>
  • The function to invoke.

Returns

Promise<R>

A promise that resolves to the return value of the specified function.