Skip to main content
Module

x/async/mod.ts>Semaphore#lock

🦕 Asynchronous primitive modules for Deno.
Latest
method Semaphore.prototype.lock
import { Semaphore } from "https://deno.land/x/async@v2.1.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.