Function create_lock

  • Parameters

    • Rest ...args: any[]

    Returns any

    Stability

    2 - provisional

    Creates a simple lock object with two methods, acquire and acquire_immediately.

    The acquire method takes a callback and returns the callback's return value.

    The acquire_immediately method will try to acquire the lock immediately, returning an object with both .was_acquired immediate and .result promise.

    This implementation is prone to deadlocks across multiple locks.

    See the monolithic create_multi_lock as a potential mitigation to deadlocks.

Generated using TypeDoc